Skip to content

Commit

Permalink
feat: updated tests for rolling avg plotting
Browse files Browse the repository at this point in the history
  • Loading branch information
CBROWN-ONS committed Feb 9, 2024
1 parent 34f5db9 commit ba8b571
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/gtfs/test_multi_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,14 @@ def test__plot_core(self, multi_gtfs_fixture):
"markers+lines",
"lines+markers",
], "Markers not plotted"
# rolling average
avg_fig = multi_gtfs_fixture._plot_core(
data, "trip_count", rolling_average=7
)
found_ylabel = avg_fig.layout["yaxis"]["title"]["text"]
assert (
found_ylabel == "7 Day Rolling Average"
), "Rolling average not plotted"

def test_plot_routes(self, multi_gtfs_fixture):
"""General tests for .plot_routes()."""
Expand All @@ -708,6 +716,12 @@ def test_plot_routes(self, multi_gtfs_fixture):
# plot without route type
fig = multi_gtfs_fixture.plot_routes(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
)
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()."""
Expand Down

0 comments on commit ba8b571

Please sign in to comment.