mobility-database-catalogs icon indicating copy to clipboard operation
mobility-database-catalogs copied to clipboard

test_catalogs_gtfs_source_ids_are_incremental behaviour is incorrect

Open maximearmstrong opened this issue 2 years ago • 0 comments

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.

maximearmstrong avatar May 25 '22 20:05 maximearmstrong