summary refs log tree commit diff stats
path: root/test
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-12-18 10:46:24 -0500
committerGitHub <noreply@github.com>2023-12-18 09:46:24 -0600
commit1298dce3db9571a0907404cd3af09df948255d9e (patch)
treed264a998089d8f4a5b6833220d276bf9629d2a47 /test
parent99128f67a3b4478a5561b1ba33a2f3588a61a1df (diff)
downloadlingo-apworld-1298dce3db9571a0907404cd3af09df948255d9e.tar.gz
lingo-apworld-1298dce3db9571a0907404cd3af09df948255d9e.tar.bz2
lingo-apworld-1298dce3db9571a0907404cd3af09df948255d9e.zip
Lingo: Tests no longer disable forced good item (#2602)
The static class with the "disable forced good item" field is gone. Now, certain tests that want to check for specific access progression can run a method that removes the forced good item and adds it back to the pool. Tests that don't care about this will collect the forced good item like normal. This should prevent the intermittent fill failures on complex doors unit tests, since the forced good item should provide enough locations to fill in.
Diffstat (limited to 'test')
-rw-r--r--test/TestDoors.py10
-rw-r--r--test/TestOrangeTower.py4
-rw-r--r--test/TestProgressive.py6
-rw-r--r--test/__init__.py8
4 files changed, 26 insertions, 2 deletions
diff --git a/test/TestDoors.py b/test/TestDoors.py index f496c5f..49a0f9c 100644 --- a/test/TestDoors.py +++ b/test/TestDoors.py
@@ -8,6 +8,8 @@ class TestRequiredRoomLogic(LingoTestBase):
8 } 8 }
9 9
10 def test_pilgrim_first(self) -> None: 10 def test_pilgrim_first(self) -> None:
11 self.remove_forced_good_item()
12
11 self.assertFalse(self.multiworld.state.can_reach("The Seeker", "Region", self.player)) 13 self.assertFalse(self.multiworld.state.can_reach("The Seeker", "Region", self.player))
12 self.assertFalse(self.multiworld.state.can_reach("Pilgrim Antechamber", "Region", self.player)) 14 self.assertFalse(self.multiworld.state.can_reach("Pilgrim Antechamber", "Region", self.player))
13 self.assertFalse(self.multiworld.state.can_reach("Pilgrim Room", "Region", self.player)) 15 self.assertFalse(self.multiworld.state.can_reach("Pilgrim Room", "Region", self.player))
@@ -28,6 +30,8 @@ class TestRequiredRoomLogic(LingoTestBase):
28 self.assertTrue(self.can_reach_location("The Seeker - Achievement")) 30 self.assertTrue(self.can_reach_location("The Seeker - Achievement"))
29 31
30 def test_hidden_first(self) -> None: 32 def test_hidden_first(self) -> None:
33 self.remove_forced_good_item()
34
31 self.assertFalse(self.multiworld.state.can_reach("The Seeker", "Region", self.player)) 35 self.assertFalse(self.multiworld.state.can_reach("The Seeker", "Region", self.player))
32 self.assertFalse(self.multiworld.state.can_reach("Pilgrim Room", "Region", self.player)) 36 self.assertFalse(self.multiworld.state.can_reach("Pilgrim Room", "Region", self.player))
33 self.assertFalse(self.can_reach_location("The Seeker - Achievement")) 37 self.assertFalse(self.can_reach_location("The Seeker - Achievement"))
@@ -55,6 +59,8 @@ class TestRequiredDoorLogic(LingoTestBase):
55 } 59 }
56 60
57 def test_through_rhyme(self) -> None: 61 def test_through_rhyme(self) -> None:
62 self.remove_forced_good_item()
63
58 self.assertFalse(self.can_reach_location("Rhyme Room - Circle/Looped Square Wall")) 64 self.assertFalse(self.can_reach_location("Rhyme Room - Circle/Looped Square Wall"))
59 65
60 self.collect_by_name("Starting Room - Rhyme Room Entrance") 66 self.collect_by_name("Starting Room - Rhyme Room Entrance")
@@ -64,6 +70,8 @@ class TestRequiredDoorLogic(LingoTestBase):
64 self.assertTrue(self.can_reach_location("Rhyme Room - Circle/Looped Square Wall")) 70 self.assertTrue(self.can_reach_location("Rhyme Room - Circle/Looped Square Wall"))
65 71
66 def test_through_hidden(self) -> None: 72 def test_through_hidden(self) -> None:
73 self.remove_forced_good_item()
74
67 self.assertFalse(self.can_reach_location("Rhyme Room - Circle/Looped Square Wall")) 75 self.assertFalse(self.can_reach_location("Rhyme Room - Circle/Looped Square Wall"))
68 76
69 self.collect_by_name("Starting Room - Rhyme Room Entrance") 77 self.collect_by_name("Starting Room - Rhyme Room Entrance")
@@ -83,6 +91,8 @@ class TestSimpleDoors(LingoTestBase):
83 } 91 }
84 92
85 def test_requirement(self): 93 def test_requirement(self):
94 self.remove_forced_good_item()
95
86 self.assertFalse(self.multiworld.state.can_reach("Outside The Wanderer", "Region", self.player)) 96 self.assertFalse(self.multiworld.state.can_reach("Outside The Wanderer", "Region", self.player))
87 self.assertFalse(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player)) 97 self.assertFalse(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player))
88 98
diff --git a/test/TestOrangeTower.py b/test/TestOrangeTower.py index 7b0c3bb..9170de1 100644 --- a/test/TestOrangeTower.py +++ b/test/TestOrangeTower.py
@@ -8,6 +8,8 @@ class TestProgressiveOrangeTower(LingoTestBase):
8 } 8 }
9 9
10 def test_from_welcome_back(self) -> None: 10 def test_from_welcome_back(self) -> None:
11 self.remove_forced_good_item()
12
11 self.assertFalse(self.multiworld.state.can_reach("Orange Tower First Floor", "Region", self.player)) 13 self.assertFalse(self.multiworld.state.can_reach("Orange Tower First Floor", "Region", self.player))
12 self.assertFalse(self.multiworld.state.can_reach("Orange Tower Second Floor", "Region", self.player)) 14 self.assertFalse(self.multiworld.state.can_reach("Orange Tower Second Floor", "Region", self.player))
13 self.assertFalse(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player)) 15 self.assertFalse(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player))
@@ -83,6 +85,8 @@ class TestProgressiveOrangeTower(LingoTestBase):
83 self.assertTrue(self.multiworld.state.can_reach("Orange Tower Seventh Floor", "Region", self.player)) 85 self.assertTrue(self.multiworld.state.can_reach("Orange Tower Seventh Floor", "Region", self.player))
84 86
85 def test_from_hub_room(self) -> None: 87 def test_from_hub_room(self) -> None:
88 self.remove_forced_good_item()
89
86 self.assertFalse(self.multiworld.state.can_reach("Orange Tower First Floor", "Region", self.player)) 90 self.assertFalse(self.multiworld.state.can_reach("Orange Tower First Floor", "Region", self.player))
87 self.assertFalse(self.multiworld.state.can_reach("Orange Tower Second Floor", "Region", self.player)) 91 self.assertFalse(self.multiworld.state.can_reach("Orange Tower Second Floor", "Region", self.player))
88 self.assertFalse(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player)) 92 self.assertFalse(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player))
diff --git a/test/TestProgressive.py b/test/TestProgressive.py index 917c6e7..8edc7ce 100644 --- a/test/TestProgressive.py +++ b/test/TestProgressive.py
@@ -7,6 +7,8 @@ class TestComplexProgressiveHallwayRoom(LingoTestBase):
7 } 7 }
8 8
9 def test_item(self): 9 def test_item(self):
10 self.remove_forced_good_item()
11
10 self.assertFalse(self.multiworld.state.can_reach("Outside The Agreeable", "Region", self.player)) 12 self.assertFalse(self.multiworld.state.can_reach("Outside The Agreeable", "Region", self.player))
11 self.assertFalse(self.multiworld.state.can_reach("Hallway Room (2)", "Region", self.player)) 13 self.assertFalse(self.multiworld.state.can_reach("Hallway Room (2)", "Region", self.player))
12 self.assertFalse(self.multiworld.state.can_reach("Hallway Room (3)", "Region", self.player)) 14 self.assertFalse(self.multiworld.state.can_reach("Hallway Room (3)", "Region", self.player))
@@ -58,6 +60,8 @@ class TestSimpleHallwayRoom(LingoTestBase):
58 } 60 }
59 61
60 def test_item(self): 62 def test_item(self):
63 self.remove_forced_good_item()
64
61 self.assertFalse(self.multiworld.state.can_reach("Outside The Agreeable", "Region", self.player)) 65 self.assertFalse(self.multiworld.state.can_reach("Outside The Agreeable", "Region", self.player))
62 self.assertFalse(self.multiworld.state.can_reach("Hallway Room (2)", "Region", self.player)) 66 self.assertFalse(self.multiworld.state.can_reach("Hallway Room (2)", "Region", self.player))
63 self.assertFalse(self.multiworld.state.can_reach("Hallway Room (3)", "Region", self.player)) 67 self.assertFalse(self.multiworld.state.can_reach("Hallway Room (3)", "Region", self.player))
@@ -86,6 +90,8 @@ class TestProgressiveArtGallery(LingoTestBase):
86 } 90 }
87 91
88 def test_item(self): 92 def test_item(self):
93 self.remove_forced_good_item()
94
89 self.assertFalse(self.multiworld.state.can_reach("Art Gallery", "Region", self.player)) 95 self.assertFalse(self.multiworld.state.can_reach("Art Gallery", "Region", self.player))
90 self.assertFalse(self.multiworld.state.can_reach("Art Gallery (Second Floor)", "Region", self.player)) 96 self.assertFalse(self.multiworld.state.can_reach("Art Gallery (Second Floor)", "Region", self.player))
91 self.assertFalse(self.multiworld.state.can_reach("Art Gallery (Third Floor)", "Region", self.player)) 97 self.assertFalse(self.multiworld.state.can_reach("Art Gallery (Third Floor)", "Region", self.player))
diff --git a/test/__init__.py b/test/__init__.py index ffbf903..7ff456d 100644 --- a/test/__init__.py +++ b/test/__init__.py
@@ -1,7 +1,6 @@
1from typing import ClassVar 1from typing import ClassVar
2 2
3from test.bases import WorldTestBase 3from test.bases import WorldTestBase
4from .. import LingoTestOptions
5 4
6 5
7class LingoTestBase(WorldTestBase): 6class LingoTestBase(WorldTestBase):
@@ -9,5 +8,10 @@ class LingoTestBase(WorldTestBase):
9 player: ClassVar[int] = 1 8 player: ClassVar[int] = 1
10 9
11 def world_setup(self, *args, **kwargs): 10 def world_setup(self, *args, **kwargs):
12 LingoTestOptions.disable_forced_good_item = True
13 super().world_setup(*args, **kwargs) 11 super().world_setup(*args, **kwargs)
12
13 def remove_forced_good_item(self):
14 location = self.multiworld.get_location("Second Room - Good Luck", self.player)
15 self.remove(location.item)
16 self.multiworld.itempool.append(location.item)
17 self.multiworld.state.events.add(location)