Skip to content

Commit

Permalink
FIX: errors in tyre data parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
theOehrly committed Oct 16, 2024
1 parent bc44a54 commit 94fb599
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion fastf1/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_timing_app_data():
assert len(data.columns) == 13
assert (data.dtypes == [
'float64', 'object', 'timedelta64[ns]', 'int64', 'float64',
'object', 'bool', 'bool', 'timedelta64[ns]', 'float64',
'object', 'object', 'object', 'timedelta64[ns]', 'float64',
'object', 'float64', 'object']).all()


Expand Down
27 changes: 27 additions & 0 deletions fastf1/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,30 @@ def test_rcm_parsing_deleted_laps():
assert not fastest['Deleted']
assert fastest['DeletedReason'] == ""
assert fastest['IsPersonalBest']


def test_tyre_data_parsing():
session = fastf1.get_session(2024, 'Silverstone', 'FP1')
session.load(telemetry=False)

ver = session.laps.pick_drivers('VER')

ref = pd.DataFrame(
[[1.0, 'HARD', True, 1.0], [1.0, 'HARD', True, 2.0],
[1.0, 'HARD', True, 3.0], [1.0, 'HARD', True, 4.0],
[1.0, 'HARD', True, 5.0], [2.0, 'HARD', False, 6.0],
[2.0, 'HARD', False, 7.0], [2.0, 'HARD', False, 8.0],
[3.0, 'MEDIUM', True, 1.0], [3.0, 'MEDIUM', True, 2.0],
[3.0, 'MEDIUM', True, 3.0], [3.0, 'MEDIUM', True, 4.0],
[3.0, 'MEDIUM', True, 5.0], [4.0, 'HARD', False, 9.0],
[4.0, 'HARD', False, 10.0], [4.0, 'HARD', False, 11.0],
[4.0, 'HARD', False, 12.0], [4.0, 'HARD', False, 13.0],
[4.0, 'HARD', False, 14.0], [4.0, 'HARD', False, 15.0],
[4.0, 'HARD', False, 16.0], [4.0, 'HARD', False, 17.0],
[4.0, 'HARD', False, 18.0], [4.0, 'HARD', False, 19.0],
[4.0, 'HARD', False, 20.0]],
columns=['Stint', 'Compound', 'FreshTyre', 'TyreLife']
)

compare = ver[['Stint', 'Compound', 'FreshTyre', 'TyreLife']]
assert compare.equals(ref)

0 comments on commit 94fb599

Please sign in to comment.