core: fix item/location descriptions test (#2450)

This commit is contained in:
el-u
2023-11-15 07:26:10 +01:00
committed by GitHub
parent 41b6aef23c
commit 2af5410301
3 changed files with 18 additions and 21 deletions

View File

@@ -333,24 +333,3 @@ class WorldTestBase(unittest.TestCase):
placed_items = [loc.item for loc in self.multiworld.get_locations() if loc.item and loc.item.code]
self.assertLessEqual(len(self.multiworld.itempool), len(placed_items),
"Unplaced Items remaining in itempool")
def test_descriptions_have_valid_names(self):
"""Ensure all item and location descriptions match a name of the corresponding type"""
if not (self.run_default_tests and self.constructed):
return
with self.subTest("Game", game=self.game):
with self.subTest("Items"):
world = self.multiworld.worlds[1]
valid_names = world.item_names.union(world.item_name_groups)
for name in world.item_descriptions.keys():
with self.subTest("Name should be valid", name=name):
self.assertIn(name, valid_names,
"""All item descriptions must match defined item names""")
with self.subTest("Locations"):
world = self.multiworld.worlds[1]
valid_names = world.location_names.union(world.location_name_groups)
for name in world.location_descriptions.keys():
with self.subTest("Name should be valid", name=name):
self.assertIn(name, valid_names,
"""All item descriptions must match defined item names""")