Tests: add test that option classes aren't reused (#3530)

This commit is contained in:
Aaron Wagener 2024-10-30 17:32:38 -05:00 committed by GitHub
parent f00975c73d
commit aaf25f8c6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 0 deletions

View File

@ -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 = [