diff --git a/worlds/witness/test/test_misc.py b/worlds/witness/test/test_misc.py new file mode 100644 index 000000000000..9e638d1a3a4f --- /dev/null +++ b/worlds/witness/test/test_misc.py @@ -0,0 +1,31 @@ +from dataclasses import fields +from typing import cast + +from Options import Option +from worlds.AutoWorld import call_all +from worlds.witness import witness_option_groups, TheWitnessOptions +from worlds.witness.test import WitnessTestBase + +_hint_option_groups = {"Hints"} +_hint_options = { + option + for group in witness_option_groups if group.name in _hint_option_groups + for option in group.options +} +_hint_option_names = [ + option.name for option in fields(TheWitnessOptions) + if option.type in _hint_options + and cast(Option, option.type).supports_weighting +] + + +class TestNothingItemsDontCrash(WitnessTestBase): + options = {option_name: "random" for option_name in _hint_option_names} + + def test_nothing_items_dont_crash(self) -> None: + """ + Test that post_fill and fill_slot_data work even if there are Nothing items. + """ + self.assertIsNone(self.world.get_location("Desert Surface 8").item) + for step in ["post_fill", "fill_slot_data"]: + call_all(self.multiworld, step)