From 809bda02d1cc79e438171286aadb77603c582428 Mon Sep 17 00:00:00 2001 From: black-sliver <59490463+black-sliver@users.noreply.github.com> Date: Tue, 20 Sep 2022 08:09:08 +0200 Subject: [PATCH] Test: item/location name must not be numeric --- test/general/TestNames.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test/general/TestNames.py diff --git a/test/general/TestNames.py b/test/general/TestNames.py new file mode 100644 index 00000000..6dae5324 --- /dev/null +++ b/test/general/TestNames.py @@ -0,0 +1,20 @@ +import unittest +from worlds.AutoWorld import AutoWorldRegister + + +class TestNames(unittest.TestCase): + def testItemNamesFormat(self): + """Item names must not be all numeric in order to differentiate between ID and name in !hint""" + for gamename, world_type in AutoWorldRegister.world_types.items(): + with self.subTest(game=gamename): + for item_name in world_type.item_name_to_id: + self.assertFalse(item_name.isnumeric(), + f"Item name \"{item_name}\" is invalid. It must not be numeric.") + + def testLocationNameFormat(self): + """Location names must not be all numeric in order to differentiate between ID and name in !hint_location""" + for gamename, world_type in AutoWorldRegister.world_types.items(): + with self.subTest(game=gamename): + for location_name in world_type.location_name_to_id: + self.assertFalse(location_name.isnumeric(), + f"Location name \"{location_name}\" is invalid. It must not be numeric.")