2022-05-10 17:40:43 +00:00
|
|
|
import unittest
|
2022-05-10 17:43:44 +00:00
|
|
|
from worlds.AutoWorld import AutoWorldRegister
|
2022-05-10 17:40:43 +00:00
|
|
|
|
2023-02-15 21:46:10 +00:00
|
|
|
from . import setup_solo_multiworld
|
2022-05-10 17:40:43 +00:00
|
|
|
|
|
|
|
|
2022-05-10 17:43:44 +00:00
|
|
|
class TestImplemented(unittest.TestCase):
|
2022-05-10 17:40:43 +00:00
|
|
|
def testCompletionCondition(self):
|
|
|
|
"""Ensure a completion condition is set that has requirements."""
|
2023-02-13 01:05:52 +00:00
|
|
|
for game_name, world_type in AutoWorldRegister.world_types.items():
|
2023-02-24 02:16:10 +00:00
|
|
|
if not world_type.hidden and game_name not in {"Sudoku"}:
|
2023-02-13 01:05:52 +00:00
|
|
|
with self.subTest(game_name):
|
2023-02-15 21:46:10 +00:00
|
|
|
multiworld = setup_solo_multiworld(world_type)
|
2023-02-13 01:05:52 +00:00
|
|
|
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():
|
2023-02-15 21:46:10 +00:00
|
|
|
if not world_type.hidden:
|
2023-02-13 01:05:52 +00:00
|
|
|
with self.subTest(game_name):
|
2023-02-15 21:46:10 +00:00
|
|
|
multiworld = setup_solo_multiworld(world_type)
|
2023-02-13 01:05:52 +00:00
|
|
|
for region in multiworld.regions:
|
|
|
|
for exit in region.exits:
|
|
|
|
self.assertEqual(exit.parent_region, region)
|
2023-02-15 23:28:02 +00:00
|
|
|
|
|
|
|
def testStageMethods(self):
|
|
|
|
"""Tests that worlds don't try to implement certain steps that are only ever called as stage."""
|
|
|
|
for game_name, world_type in AutoWorldRegister.world_types.items():
|
|
|
|
if not world_type.hidden:
|
|
|
|
with self.subTest(game_name):
|
|
|
|
for method in ("assert_generate",):
|
|
|
|
self.assertFalse(hasattr(world_type, method),
|
|
|
|
f"{method} must be implemented as a @classmethod named stage_{method}.")
|