From aaf25f8c6f3f19243645ae6c1c128b85adaaf6ba Mon Sep 17 00:00:00 2001 From: Aaron Wagener Date: Wed, 30 Oct 2024 17:32:38 -0500 Subject: [PATCH] Tests: add test that option classes aren't reused (#3530) --- test/general/test_options.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/general/test_options.py b/test/general/test_options.py index ee2f22a6..d6d5ce6d 100644 --- a/test/general/test_options.py +++ b/test/general/test_options.py @@ -21,6 +21,17 @@ class TestOptions(unittest.TestCase): self.assertFalse(hasattr(world_type, "options"), f"Unexpected assignment to {world_type.__name__}.options!") + def test_duplicate_options(self) -> None: + """Tests that a world doesn't reuse the same option class.""" + for game_name, world_type in AutoWorldRegister.world_types.items(): + with self.subTest(game=game_name): + seen_options = set() + for option in world_type.options_dataclass.type_hints.values(): + if not option.visibility: + continue + self.assertFalse(option in seen_options, f"{option} found in assigned options multiple times.") + seen_options.add(option) + def test_item_links_name_groups(self): """Tests that item links successfully unfold item_name_groups""" item_link_groups = [