From 90813c0f4b7ebb27f03b3c8e61786d7f38b9f603 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Mon, 27 Mar 2023 01:04:13 +0200 Subject: [PATCH] Test: explicitly make sure there is no double use of location Name or ID (#1605) --- test/general/TestLocations.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/general/TestLocations.py b/test/general/TestLocations.py index f1b3349e..8e4e3ab1 100644 --- a/test/general/TestLocations.py +++ b/test/general/TestLocations.py @@ -6,13 +6,19 @@ from . import setup_solo_multiworld class TestBase(unittest.TestCase): def testCreateDuplicateLocations(self): - """Tests that no two Locations share a name.""" + """Tests that no two Locations share a name or ID.""" for game_name, world_type in AutoWorldRegister.world_types.items(): multiworld = setup_solo_multiworld(world_type) - locations = Counter(multiworld.get_locations()) + locations = Counter(location.name for location in multiworld.get_locations()) if locations: self.assertLessEqual(locations.most_common(1)[0][1], 1, - f"{world_type.game} has duplicate of location {locations.most_common(1)}") + f"{world_type.game} has duplicate of location name {locations.most_common(1)}") + + locations = Counter(location.address for location in multiworld.get_locations() + if type(location.address) is int) + if locations: + self.assertLessEqual(locations.most_common(1)[0][1], 1, + f"{world_type.game} has duplicate of location ID {locations.most_common(1)}") def testLocationsInDatapackage(self): """Tests that created locations not filled before fill starts exist in the datapackage."""