Skip to content

Commit

Permalink
Merge pull request #21 from TransitApp/fix/conditional-transfer-count…
Browse files Browse the repository at this point in the history
…-validation

Fix: add error for empty transfer count when leg group ids match
  • Loading branch information
jsteelz authored Jul 4, 2022
2 parents 18b521c + 05baef1 commit bdcd086
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
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

0 comments on commit bdcd086

Please sign in to comment.