Skip to content

Commit

Permalink
Added additional comments
Browse files Browse the repository at this point in the history
  • Loading branch information
CBROWN-ONS committed Aug 9, 2023
1 parent cd62017 commit 629ac79
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/gtfs/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,8 @@ def test__plot_summary_defences(self, gtfs_fixture):
"""Test defences for _plot_summary()."""
current_fixture = gtfs_fixture
current_fixture.summarise_routes()

# test parameters that are yet to be tested
with pytest.raises(
ValueError,
match=re.escape(
Expand All @@ -593,6 +595,7 @@ def test__plot_summary_defences(self, gtfs_fixture):
orientation="l",
)

# test the ability to make a directory
with pytest.raises(
NotADirectoryError,
match=re.escape(
Expand All @@ -610,20 +613,24 @@ def test__plot_summary_on_pass(self, gtfs_fixture):
"""Test plotting a summary when defences are passed."""
current_fixture = gtfs_fixture
current_fixture.summarise_routes()

# test returning a html string
test_html = gtfs_fixture._plot_summary(
gtfs_fixture.daily_route_summary,
"route_count_mean",
return_html=True,
)
assert type(test_html) == str, "Failed to return HTML for the plot"

# test returning a plotly figure
test_image = gtfs_fixture._plot_summary(
gtfs_fixture.daily_route_summary, "route_count_mean"
)
assert (
type(test_image) == PlotlyFigure
), "Failed to return plotly.graph_objects.Figure type"

# test saving plots in html and png format
gtfs_fixture._plot_summary(
gtfs_fixture.daily_route_summary,
"route_count_mean",
Expand Down Expand Up @@ -663,6 +670,7 @@ def test__plot_summary_on_pass(self, gtfs_fixture):

def test__plot_route_summary_defences(self, gtfs_fixture):
"""Test the defences for the small wrapper plot_route_summary()."""
# test attribute checks
with pytest.raises(
AttributeError,
match=(
Expand All @@ -676,6 +684,7 @@ def test__plot_route_summary_defences(self, gtfs_fixture):

def test__plot_trip_summary_defences(self, gtfs_fixture):
"""Test the defences for the small wrapper plot_trip_summary()."""
# test attribute checks
with pytest.raises(
AttributeError,
match=(
Expand Down

0 comments on commit 629ac79

Please sign in to comment.