Skip to content

Commit

Permalink
refactor: Reduce tests to common func
Browse files Browse the repository at this point in the history
  • Loading branch information
r-leyshon committed Feb 15, 2024
1 parent bc75e18 commit d8ead20
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions tests/gtfs/test_multi_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,26 +714,27 @@ def test__plot_core(self, multi_gtfs_fixture):
found_line = avg_fig.layout["shapes"][0]["line"]["dash"]
assert found_line == "dash", "Date line not plotted"

def test_plot_routes(self, multi_gtfs_fixture):
"""General tests for .plot_routes()."""
def test_plot_service(self, multi_gtfs_fixture):
"""General tests for .plot_service()."""
# plot route_type
fig = multi_gtfs_fixture.plot_routes()
fig = multi_gtfs_fixture.plot_service(service_type="routes")
assert len(fig.data) == 2, "Not plotted by modality"
# plot without route type
fig = multi_gtfs_fixture.plot_routes(False)
fig = multi_gtfs_fixture.plot_service(
service_type="routes", route_type=False
)
assert len(fig.data) == 1, "Plot not as expected"
# rolling average + no route type
avg_fig = multi_gtfs_fixture.plot_routes(
rolling_average=7, route_type=False
avg_fig = multi_gtfs_fixture.plot_service(
service_type="routes", rolling_average=7, route_type=False
)
leg_status = avg_fig.data[0]["showlegend"]
assert not leg_status, "Multiple route types found"

def test_plot_trips(self, multi_gtfs_fixture):
"""General tests for .plot_trips()."""
# plot route_type
fig = multi_gtfs_fixture.plot_trips()
# plot trips
fig = multi_gtfs_fixture.plot_service(service_type="trips")
assert len(fig.data) == 2, "Not plotted by modality"
# plot without route type
fig = multi_gtfs_fixture.plot_trips(False)
fig = multi_gtfs_fixture.plot_service(
service_type="trips", route_type=False
)
assert len(fig.data) == 1, "Plot not as expected"

0 comments on commit d8ead20

Please sign in to comment.