From 8fa56c605c985bceb1267c1743125145affdaa35 Mon Sep 17 00:00:00 2001 From: Marsh Macy Date: Thu, 15 Oct 2026 18:44:07 -0700 Subject: [PATCH] Test that passages may share coordinates across levels A validate_adventure check that compared positions without the level would refuse a passage landing on another level's cell with its own coordinates, or on a cell whose coordinates match a far cell on a different level. The fixture had neither case, so this test adds both and requires them to validate clean. --- tests/test_passages.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_passages.py b/tests/test_passages.py index 1cde2b3..e24446a 100644 --- a/tests/test_passages.py +++ b/tests/test_passages.py @@ -464,6 +464,20 @@ class TestValidation: def test_the_fixture_is_valid(self): assert refusals(passage_adventure()) == "" + def test_coordinates_shared_across_levels_are_valid(self): + # Level 1's (3, 1) is a far cell and level 2's (3, 1) is floor, so a passage may land on + # level 2's (3, 1). A passage on level 2's (2, 1) may land on level 1's (2, 1), which is + # another level's cell with the same coordinates, not its own. + adventure = passage_adventure() + level_1, level_2 = adventure.dungeons[0].levels + adventure = with_level( + adventure, 1, transitions=(*level_1.transitions, passage((6, 1), NORTH, 2, (3, 1), WEST)) + ) + adventure = with_level( + adventure, 2, transitions=(*level_2.transitions, passage((2, 1), SOUTH, 1, (2, 1), WEST)) + ) + assert refusals(adventure) == "" + def test_a_passage_on_a_side_that_is_not_a_wall(self): adventure = passage_adventure() level_1 = adventure.dungeons[0].levels[0]