mobility-database-catalogs
mobility-database-catalogs copied to clipboard
test_catalogs_gtfs_source_ids_are_incremental behaviour is incorrect
Describe the bug
The test should fail if a mdb_source_id
is duplicated, but it does not. It probably stopped working after the catalog representation changed from a list to a dictionary, because a source with a duplicate mdb_source_id
just overwrites the previous one in the dictionary with catalog[entity_id] = entity_cls(filename=file, **entity_json)
(line 85 of representations.py).
This may also happen using the get_sources
operations, because we are merging the catalogs using update()
with sources.update(globals()[f"{catalog_cls}"]().get_sources())
. A source with a duplicate mdb_source_id
overwrites the previous one here as well.
Expected behavior
The test_catalogs_gtfs_source_ids_are_incremental
test should fail if a mdb_source_id
is duplicated. The behavior of the representation and the operation should remain the same, since it's up to the integration tests to detect this problem upstream in the PR - sources with a duplicate mdb_source_id
should not be merged at all, so the catalog itself should not have to do this check.