Added PitStops pytest
This commit is contained in:
parent
0fb9664bb6
commit
664ebcff98
@ -13,11 +13,11 @@ class PitStop():
|
|||||||
driver_id: String
|
driver_id: String
|
||||||
lap: Integer
|
lap: Integer
|
||||||
stop: Integer
|
stop: Integer
|
||||||
local_time: datetime.datetime
|
local_time: datetime.time
|
||||||
duration: 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:
|
duration: datetime.time) -> None:
|
||||||
self.driver_id = driver_id
|
self.driver_id = driver_id
|
||||||
self.lap = lap
|
self.lap = lap
|
||||||
|
@ -8,6 +8,7 @@ from ergast_py.models.constructor import Constructor
|
|||||||
from ergast_py.models.driver import Driver
|
from ergast_py.models.driver import Driver
|
||||||
from ergast_py.models.fastest_lap import FastestLap
|
from ergast_py.models.fastest_lap import FastestLap
|
||||||
from ergast_py.models.location import Location
|
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.models.result import Result
|
||||||
from ergast_py.requester import Requester
|
from ergast_py.requester import Requester
|
||||||
from ergast_py.type_constructor import TypeConstructor
|
from ergast_py.type_constructor import TypeConstructor
|
||||||
@ -129,7 +130,23 @@ class TestTypeConstructor():
|
|||||||
assert expected == self.t.construct_results(params)
|
assert expected == self.t.construct_results(params)
|
||||||
|
|
||||||
def test_construct_pit_stops(self):
|
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):
|
def test_construct_laps(self):
|
||||||
# Check Timings too
|
# Check Timings too
|
||||||
|
Reference in New Issue
Block a user