-
Notifications
You must be signed in to change notification settings - Fork 812
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Core: Add connect_entrances world step/stage (#4420)
* Add connect_entrances * update ER docs * fix that test, but also ew * Add a test that asserts the new finalization * Rewrite test a bit * rewrite some more * blank line * rewrite rewrite rewrite * rewrite rewrite rewrite * RE. WRITE. * oops * Bruh * I guess, while we're at it * giga oops * It's been a long day * Switch KH1 over to this design with permission of GICU * Revert * Oops * Bc I like it * Update locations.py
- Loading branch information
Showing
12 changed files
with
87 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import unittest | ||
from worlds.AutoWorld import AutoWorldRegister, call_all, World | ||
from . import setup_solo_multiworld | ||
|
||
|
||
class TestBase(unittest.TestCase): | ||
def test_entrance_connection_steps(self): | ||
"""Tests that Entrances are connected and not changed after connect_entrances.""" | ||
def get_entrance_name_to_source_and_target_dict(world: World): | ||
return [ | ||
(entrance.name, entrance.parent_region, entrance.connected_region) | ||
for entrance in world.get_entrances() | ||
] | ||
|
||
gen_steps = ("generate_early", "create_regions", "create_items", "set_rules", "connect_entrances") | ||
additional_steps = ("generate_basic", "pre_fill") | ||
|
||
for game_name, world_type in AutoWorldRegister.world_types.items(): | ||
with self.subTest("Game", game_name=game_name): | ||
multiworld = setup_solo_multiworld(world_type, gen_steps) | ||
|
||
original_entrances = get_entrance_name_to_source_and_target_dict(multiworld.worlds[1]) | ||
|
||
self.assertTrue( | ||
all(entrance[1] is not None and entrance[2] is not None for entrance in original_entrances), | ||
f"{game_name} had unconnected entrances after connect_entrances" | ||
) | ||
|
||
for step in additional_steps: | ||
with self.subTest("Step", step=step): | ||
call_all(multiworld, step) | ||
step_entrances = get_entrance_name_to_source_and_target_dict(multiworld.worlds[1]) | ||
|
||
self.assertEqual( | ||
original_entrances, step_entrances, f"{game_name} modified entrances during {step}" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters