From 9e3c2e2464d1cef2b6c9957725ed9d40ce289455 Mon Sep 17 00:00:00 2001 From: alwaysintreble Date: Sun, 12 Feb 2023 19:05:52 -0600 Subject: [PATCH] Tests: test that exits to `Regions` are the parents of the `Entrance` (#1442) --- test/general/TestImplemented.py | 20 +++++++++++++++----- test/general/TestReachability.py | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/test/general/TestImplemented.py b/test/general/TestImplemented.py index 15e099ff..490e3b85 100644 --- a/test/general/TestImplemented.py +++ b/test/general/TestImplemented.py @@ -7,8 +7,18 @@ from . import setup_default_world class TestImplemented(unittest.TestCase): def testCompletionCondition(self): """Ensure a completion condition is set that has requirements.""" - for gamename, world_type in AutoWorldRegister.world_types.items(): - if not world_type.hidden and gamename not in {"ArchipIDLE", "Final Fantasy", "Sudoku"}: - with self.subTest(gamename): - world = setup_default_world(world_type) - self.assertFalse(world.completion_condition[1](world.state)) + for game_name, world_type in AutoWorldRegister.world_types.items(): + if not world_type.hidden and game_name not in {"ArchipIDLE", "Final Fantasy", "Sudoku"}: + with self.subTest(game_name): + multiworld = setup_default_world(world_type) + self.assertFalse(multiworld.completion_condition[1](multiworld.state)) + + def testEntranceParents(self): + """Tests that the parents of created Entrances match the exiting Region.""" + for game_name, world_type in AutoWorldRegister.world_types.items(): + if not world_type.hidden and game_name not in {"Final Fantasy"}: + with self.subTest(game_name): + multiworld = setup_default_world(world_type) + for region in multiworld.regions: + for exit in region.exits: + self.assertEqual(exit.parent_region, region) diff --git a/test/general/TestReachability.py b/test/general/TestReachability.py index 13d56d74..b70ed236 100644 --- a/test/general/TestReachability.py +++ b/test/general/TestReachability.py @@ -12,7 +12,7 @@ class TestBase(unittest.TestCase): def testAllStateCanReachEverything(self): for game_name, world_type in AutoWorldRegister.world_types.items(): # Final Fantasy logic is controlled by finalfantasyrandomizer.com - if game_name != "Ori and the Blind Forest" and game_name != "Final Fantasy": # TODO: fix Ori Logic + if game_name not in {"Ori and the Blind Forest", "Final Fantasy"}: # TODO: fix Ori Logic with self.subTest("Game", game=game_name): world = setup_default_world(world_type) excluded = world.exclude_locations[1].value