-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTML outputs for GTFS data. #112
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## dev #112 +/- ##
==========================================
+ Coverage 84.86% 87.27% +2.41%
==========================================
Files 10 11 +1
Lines 674 896 +222
==========================================
+ Hits 572 782 +210
- Misses 102 114 +12
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
d9da952
to
7a728b7
Compare
refactor: Several type utils -> _type_defence
tests/gtfs/test_validation.py
Outdated
def test__plot_route_summary_on_pass(self, gtfs_fixture): | ||
"""Test plot_route_summary() calls _plot_summary() succesfully.""" | ||
gtfs_fixture.summarise_routes() | ||
assert isinstance( | ||
gtfs_fixture.plot_route_summary(target_summary="mean"), | ||
PlotlyFigure, | ||
), "plot_route_summary() failed to return plotly figure" | ||
|
||
def test__plot_trip_summary_on_pass(self, gtfs_fixture): | ||
"""Test plot_trip_summary() calls _plot_summary() succesfully.""" | ||
gtfs_fixture.summarise_trips() | ||
assert isinstance( | ||
gtfs_fixture.plot_trip_summary(target_summary="mean"), PlotlyFigure | ||
), "plot_trip_summary() failed to return plotly figure" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests are clones of each other, testing the same logic in the src code that I suggested would be better refactored to one method.
…defences;Included and updated testing for all changes/additions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CBROWN-ONS This issue with the lint being written out to directory. This file has been mistakenly committed and the test is writing out directories / css files (interestingly, the css file doesn't always appear though).
Uncertain what the cause is as your use of tmp_pth looks fine. May need to default to tmpdir if we can't get tmp_pth to behave as needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just pushed up the removal of this lint and re-running. Problem seems to have gone away for me. If you could confirm on your end? Just run the pytest (maybe coverage run -m pytest too just to be sure) and confirm that no lint is being written out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@r-leyshon. It has now been removed from the branch completely. I can confirm that it isn't present and that it also does not impact any of the tests (the test suite is running smoothly).
I think it was a remnant of an older test I had implemented that had since been removed.
All seems fine on my end now
* Add code for producing HTML outputs for GTFS data * Update requirements.txt * fix: Update tests to reflect changes * Added better file ext checking; update tests; added new tests * chore: Clean up docstrings to comply with numpy formatting * chore: Add additional raises in docstrings * chore: Breaking changes with dev resolved * refactor: Several type utils -> _type_defence * fix: Undo accidental overwrite with review branch * test: _type_defence raises with single or multiple types * test: _type_defence pass on single & multiple values to types * Refactor save paths for plotting summaries (#124) * feat: Tests for _check_column_in_df() * fix: Added another stage of testing for set_up_report_dir() which improves coverage * Updated gtfs_utils.py and corresponding tests. Removed scheme param. Improved type check. Improved type hint. Included test fixture * Make TemplateHtml methods private; Update docstring * Updated error message for replace_multiple=False and multiple placeholders found * Updated test_report_utils.py to reflect private functions * Updated _set_up_report_dir() to better suite check_parent_dir_exists() functionality * Update tests in test_report_utils * Only .lower() orientation in one place, rather than 2 * Create small helper function to remove duplicate logic; added testing * Move test to test__plot_summary_defences() as it is more appropriate * Refactore validation.py to only use _plot_summary();Added additional defences;Included and updated testing for all changes/additions * Update check_attribute() due to save error * Update defence.py * Update defence.py for missing char * chore: Run pre-commit against all files * docs: Update private methods in docstring * chore: Remove lint * refactor: Param formatting in Error message * refactor: Rm str replace carriage returns logic in test * chore: Remove filterwarning --------- Co-authored-by: r-leyshon <richard.leyshon@ons.gov.uk> 8d973c4
Description
closes #47
closes #59
closes #48
closes #46
closes #45
closes #49
Motivation and Context
This PR intends to allow for HTML reports to be created on GTFS datasets. The key functionality added through this PR is the
gtfs::validation::GtfsInstance().html_report()
method.Type of change
How Has This Been Tested?
Test configuration details:
Advice for reviewer
Checklist:
Additional comments