Skip to content
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

Fix: add error for empty transfer count when leg group ids match #21

Merged
merged 3 commits into from
Jul 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions fares_validator/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
INVALID_FARE_TRANSFER_TYPE = 'An entry in fare_transfer_rules.txt has fare_transfer_type with invalid value.'
INVALID_FROM_LEG_GROUP = 'A from_leg_group_id in fare_transfer_rules.txt is not defined in fare_leg_rules.txt.'
INVALID_TRANSFER_COUNT = 'An entry in fare_transfer_rules.txt has transfer_count with incorrect type or invalid integer value.'
EMPTY_TRANSFER_COUNT = 'An entry in fare_transfer_rules.txt has no transfer_count defined, but the from_ and to_ leg_group_ids are the same.'
INVALID_TO_LEG_GROUP = 'A to_leg_group_id in fare_transfer_rules.txt is not defined in fare_leg_rules.txt.'
NONEXISTENT_FILTER_FARE_PRODUCT_ID = 'A filter_fare_product referenced is not defined in fare_products.txt.'
TRANSFER_COUNT_WITH_BAD_LEGS = 'An entry in fare_transfer_rules.txt has transfer_count with different from and to leg group ids.'
2 changes: 2 additions & 0 deletions fares_validator/fare_transfer_rule_checkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def check_transfer_count(line):
line.add_error(INVALID_TRANSFER_COUNT)
except ValueError:
line.add_error(INVALID_TRANSFER_COUNT)
elif line.from_leg_group_id == line.to_leg_group_id:
line.add_error(EMPTY_TRANSFER_COUNT)


def check_durations(line):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ invalid_leg_group_id,1,1,,,,,,,,,,,,,1
1,,1,,,,2,,,,,,,,,1
1,1,1,,,,invalid_transfer_count,,,,,,,,,1
1,1,1,,,,0,,,,,,,,,1
1,1,1,,,,,,,1,invalid_duration_limit_type,,,,,1
1,1,1,,,,,,,1,,,,,,1
1,1,1,,,,,,,invalid_duration_limit,1,,,,,1
1,1,1,,,,,,,,1,,,,,1
1,1,1,,,,,,,,,3.00,,,USD,invalid_fare_transfer_type
1,1,1,invalid_fare_product_id,,,,,,,,,,,,
1,1,1,,,,1,,,1,invalid_duration_limit_type,,,,,1
1,1,1,,,,1,,,1,,,,,,1
1,1,1,,,,1,,,invalid_duration_limit,1,,,,,1
1,1,1,,,,1,,,,1,,,,,1
1,1,1,,,,1,,,,,3.00,,,USD,invalid_fare_transfer_type
1,1,1,invalid_fare_product_id,,,1,,,,,,,,,
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='gtfs-fares-v2-validator',
version='1.1.1',
version='1.1.2',
description=
'Validate transit feeds for conformance to the GTFS Fares v2 specification',
url='https://github.com/TransitApp/gtfs-fares-v2-validator',
Expand Down