Tests: Create CollectionState after MultiWorld.worlds (#4949)

This commit is contained in:
qwint
2025-05-22 08:27:18 -05:00
committed by GitHub
parent 44a78cc821
commit 95efcf6803
7 changed files with 7 additions and 6 deletions

View File

@@ -10,12 +10,12 @@ class LTTPTestBase(unittest.TestCase):
from worlds.alttp.Options import Medallion
self.multiworld = MultiWorld(1)
self.multiworld.game[1] = "A Link to the Past"
self.multiworld.state = CollectionState(self.multiworld)
self.multiworld.set_seed(None)
args = Namespace()
for name, option in AutoWorldRegister.world_types["A Link to the Past"].options_dataclass.type_hints.items():
setattr(args, name, {1: option.from_any(getattr(option, "default"))})
self.multiworld.set_options(args)
self.multiworld.state = CollectionState(self.multiworld)
self.world = self.multiworld.worlds[1]
# by default medallion access is randomized, for unittests we set it to vanilla
self.world.options.misery_mire_medallion.value = Medallion.option_ether

View File

@@ -26,13 +26,13 @@ class KDL3TestBase(WorldTestBase):
self.multiworld.game[1] = self.game
self.multiworld.player_name = {1: "Tester"}
self.multiworld.set_seed(seed)
self.multiworld.state = CollectionState(self.multiworld)
args = Namespace()
for name, option in AutoWorld.AutoWorldRegister.world_types[self.game].options_dataclass.type_hints.items():
setattr(args, name, {
1: option.from_any(self.options.get(name, getattr(option, "default")))
})
self.multiworld.set_options(args)
self.multiworld.state = CollectionState(self.multiworld)
self.multiworld.plando_options = PlandoOptions.connections
for step in gen_steps:
call_all(self.multiworld, step)

View File

@@ -293,12 +293,12 @@ def setup_multiworld(test_options: Iterable[Dict[str, int]] = None, seed=None) -
multiworld = MultiWorld(len(test_options))
multiworld.player_name = {}
multiworld.set_seed(seed)
multiworld.state = CollectionState(multiworld)
for i in range(1, len(test_options) + 1):
multiworld.game[i] = StardewValleyWorld.game
multiworld.player_name.update({i: f"Tester{i}"})
args = fill_namespace_with_default(test_options)
multiworld.set_options(args)
multiworld.state = CollectionState(multiworld)
for step in gen_steps:
call_all(multiworld, step)