diff --git a/ergast_py/models/pit_stop.py b/ergast_py/models/pit_stop.py index 3406ca1..dbacbad 100644 --- a/ergast_py/models/pit_stop.py +++ b/ergast_py/models/pit_stop.py @@ -13,11 +13,11 @@ class PitStop(): driver_id: String lap: Integer stop: Integer - local_time: datetime.datetime + local_time: datetime.time duration: datetime.time """ - def __init__(self, driver_id: str, lap: int, stop: int, local_time: datetime.datetime, + def __init__(self, driver_id: str, lap: int, stop: int, local_time: datetime.time, duration: datetime.time) -> None: self.driver_id = driver_id self.lap = lap diff --git a/tests/test_type_constructor.py b/tests/test_type_constructor.py index f3c8706..01ed052 100644 --- a/tests/test_type_constructor.py +++ b/tests/test_type_constructor.py @@ -8,6 +8,7 @@ from ergast_py.models.constructor import Constructor from ergast_py.models.driver import Driver from ergast_py.models.fastest_lap import FastestLap from ergast_py.models.location import Location +from ergast_py.models.pit_stop import PitStop from ergast_py.models.result import Result from ergast_py.requester import Requester from ergast_py.type_constructor import TypeConstructor @@ -129,7 +130,23 @@ class TestTypeConstructor(): assert expected == self.t.construct_results(params) def test_construct_pit_stops(self): - pass + params = [{ + "driverId":"alonso", + "lap":"11", + "stop":"1", + "time":"18:22:10", + "duration":"25.365" + }] + + expected = [PitStop( + driver_id="alonso", + lap=11, + stop=1, + local_time=datetime.time(hour=18, minute=22, second=10), + duration=datetime.time(second=25, microsecond=365000) + )] + + assert expected == self.t.construct_pit_stops(params) def test_construct_laps(self): # Check Timings too