Skip to content

Commit

Permalink
Add tests for new is_valid functionality; add additional test for val…
Browse files Browse the repository at this point in the history
…idate_route_type_warnings
  • Loading branch information
CBROWN-ONS committed Oct 19, 2023
1 parent 4f9802f commit 9131720
Show file tree
Hide file tree
Showing 3 changed files with 237 additions and 133 deletions.
8 changes: 4 additions & 4 deletions src/transport_performance/gtfs/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
PKG_PATH,
)

# THESE MAPPINGS CAN NOT BE MOVED TO CONSTANTS AS THEY INTRODUCE DEPENDENCY
# ISSUES.
CLEAN_FEED_FUNCTION_MAP = {
"clean_consecutive_stop_fast_travel_warnings": (
cleaners.clean_consecutive_stop_fast_travel_warnings
Expand Down Expand Up @@ -385,13 +387,11 @@ def is_valid(self, validators: dict = None) -> pd.DataFrame:
for key in validators.keys():
if key not in VALIDATE_FEED_FUNC_MAP.keys():
raise KeyError(
"Function name passed to 'validators' is not a known "
"validator. Known validators include: "
f"'{key}' function passed to 'validators' is not a "
"known validator. Known validators include: "
f"{VALIDATE_FEED_FUNC_MAP.keys()}"
)
for validator in validators:
# check key is str
_type_defence(validator, "Key of validators", str)
# check value is dict or none (for kwargs)
_type_defence(
validators[validator],
Expand Down
Loading

0 comments on commit 9131720

Please sign in to comment.