Tests: Standardize World Exclusions, Strengthen LCS Test (#4423)
This commit is contained in:
@@ -37,10 +37,11 @@ class TestImplemented(unittest.TestCase):
|
|||||||
|
|
||||||
def test_slot_data(self):
|
def test_slot_data(self):
|
||||||
"""Tests that if a world creates slot data, it's json serializable."""
|
"""Tests that if a world creates slot data, it's json serializable."""
|
||||||
for game_name, world_type in AutoWorldRegister.world_types.items():
|
# has an await for generate_output which isn't being called
|
||||||
# has an await for generate_output which isn't being called
|
excluded_games = ("Ocarina of Time",)
|
||||||
if game_name in {"Ocarina of Time"}:
|
worlds_to_test = {game: world
|
||||||
continue
|
for game, world in AutoWorldRegister.world_types.items() if game not in excluded_games}
|
||||||
|
for game_name, world_type in worlds_to_test.items():
|
||||||
multiworld = setup_solo_multiworld(world_type)
|
multiworld = setup_solo_multiworld(world_type)
|
||||||
with self.subTest(game=game_name, seed=multiworld.seed):
|
with self.subTest(game=game_name, seed=multiworld.seed):
|
||||||
distribute_items_restrictive(multiworld)
|
distribute_items_restrictive(multiworld)
|
||||||
|
|||||||
@@ -150,8 +150,7 @@ class TestBase(unittest.TestCase):
|
|||||||
"""Test that worlds don't modify the locality of items after duplicates are resolved"""
|
"""Test that worlds don't modify the locality of items after duplicates are resolved"""
|
||||||
gen_steps = ("generate_early",)
|
gen_steps = ("generate_early",)
|
||||||
additional_steps = ("create_regions", "create_items", "set_rules", "connect_entrances", "generate_basic", "pre_fill")
|
additional_steps = ("create_regions", "create_items", "set_rules", "connect_entrances", "generate_basic", "pre_fill")
|
||||||
worlds_to_test = {game: world for game, world in AutoWorldRegister.world_types.items()}
|
for game_name, world_type in AutoWorldRegister.world_types.items():
|
||||||
for game_name, world_type in worlds_to_test.items():
|
|
||||||
with self.subTest("Game", game=game_name):
|
with self.subTest("Game", game=game_name):
|
||||||
multiworld = setup_solo_multiworld(world_type, gen_steps)
|
multiworld = setup_solo_multiworld(world_type, gen_steps)
|
||||||
local_items = multiworld.worlds[1].options.local_items.value.copy()
|
local_items = multiworld.worlds[1].options.local_items.value.copy()
|
||||||
|
|||||||
@@ -33,7 +33,10 @@ class TestBase(unittest.TestCase):
|
|||||||
def test_location_creation_steps(self):
|
def test_location_creation_steps(self):
|
||||||
"""Tests that Regions and Locations aren't created after `create_items`."""
|
"""Tests that Regions and Locations aren't created after `create_items`."""
|
||||||
gen_steps = ("generate_early", "create_regions", "create_items")
|
gen_steps = ("generate_early", "create_regions", "create_items")
|
||||||
for game_name, world_type in AutoWorldRegister.world_types.items():
|
excluded_games = ("Ocarina of Time", "Pokemon Red and Blue")
|
||||||
|
worlds_to_test = {game: world
|
||||||
|
for game, world in AutoWorldRegister.world_types.items() if game not in excluded_games}
|
||||||
|
for game_name, world_type in worlds_to_test.items():
|
||||||
with self.subTest("Game", game_name=game_name):
|
with self.subTest("Game", game_name=game_name):
|
||||||
multiworld = setup_solo_multiworld(world_type, gen_steps)
|
multiworld = setup_solo_multiworld(world_type, gen_steps)
|
||||||
region_count = len(multiworld.get_regions())
|
region_count = len(multiworld.get_regions())
|
||||||
@@ -54,13 +57,13 @@ class TestBase(unittest.TestCase):
|
|||||||
call_all(multiworld, "generate_basic")
|
call_all(multiworld, "generate_basic")
|
||||||
self.assertEqual(region_count, len(multiworld.get_regions()),
|
self.assertEqual(region_count, len(multiworld.get_regions()),
|
||||||
f"{game_name} modified region count during generate_basic")
|
f"{game_name} modified region count during generate_basic")
|
||||||
self.assertGreaterEqual(location_count, len(multiworld.get_locations()),
|
self.assertEqual(location_count, len(multiworld.get_locations()),
|
||||||
f"{game_name} modified locations count during generate_basic")
|
f"{game_name} modified locations count during generate_basic")
|
||||||
|
|
||||||
call_all(multiworld, "pre_fill")
|
call_all(multiworld, "pre_fill")
|
||||||
self.assertEqual(region_count, len(multiworld.get_regions()),
|
self.assertEqual(region_count, len(multiworld.get_regions()),
|
||||||
f"{game_name} modified region count during pre_fill")
|
f"{game_name} modified region count during pre_fill")
|
||||||
self.assertGreaterEqual(location_count, len(multiworld.get_locations()),
|
self.assertEqual(location_count, len(multiworld.get_locations()),
|
||||||
f"{game_name} modified locations count during pre_fill")
|
f"{game_name} modified locations count during pre_fill")
|
||||||
|
|
||||||
def test_location_group(self):
|
def test_location_group(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user