59 lines
1.3 KiB
Python
59 lines
1.3 KiB
Python
# coding=UTF-8
|
|
|
|
from datetime import date
|
|
from .models import Gymnast, Accident
|
|
from datetime import datetime
|
|
import pytest
|
|
|
|
# class GymnastTestCase():
|
|
def test_gymnast_tostring():
|
|
g = Gymnast(lastname="Pauchou", firstname="Fred")
|
|
assert str(g) == "Pauchou, Fred"
|
|
|
|
|
|
def test_gymnaste_get_age():
|
|
g = Gymnast(
|
|
lastname="Pauchou",
|
|
firstname="Fred",
|
|
birthdate=datetime.strptime("03/07/1985", "%d/%m/%Y"),
|
|
)
|
|
assert g.age == 35
|
|
|
|
|
|
def test_gymnaste_get_next_age():
|
|
g = Gymnast(
|
|
lastname="Pauchou",
|
|
firstname="Fred",
|
|
birthdate=datetime.strptime("03/07/1985", "%d/%m/%Y"),
|
|
)
|
|
assert g.next_age == 36
|
|
|
|
|
|
def test_gymnaste_next_birthday():
|
|
g = Gymnast(
|
|
lastname="Pauchou",
|
|
firstname="Fred",
|
|
birthdate=datetime.strptime("03/07/1985", "%d/%m/%Y"),
|
|
)
|
|
assert g.next_birthday == datetime.strptime("03/07/2021", "%d/%m/%Y")
|
|
|
|
|
|
def test_gymnast_known_skills():
|
|
# @Fred : Comment tester cela ?
|
|
pass
|
|
|
|
|
|
def test_gymnast_actual_year_of_pratice():
|
|
# @Fred : Comment tester cela ?
|
|
pass
|
|
|
|
|
|
# class AccidentTestCase():
|
|
|
|
|
|
def test_accident_tostring():
|
|
timing = date.today()
|
|
g = Gymnast(lastname="Pauchou", firstname="Fred")
|
|
a = Accident(gymnast=g, date=timing)
|
|
assert "Pauchou, Fred (%s)" % (timing) == str(a)
|