| 
									
										
										
										
											2022-12-11 13:15:23 +01:00
										 |  |  | from test.TestBase import WorldTestBase | 
					
						
							| 
									
										
										
										
											2023-10-08 17:27:05 +02:00
										 |  |  | from typing import Iterable | 
					
						
							| 
									
										
										
										
											2022-10-18 09:54:41 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class SoETestBase(WorldTestBase): | 
					
						
							|  |  |  |     game = "Secret of Evermore" | 
					
						
							| 
									
										
										
										
											2023-10-08 17:27:05 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def assertLocationReachability(self, reachable: Iterable[str] = (), unreachable: Iterable[str] = (), | 
					
						
							|  |  |  |                                    satisfied=True) -> None: | 
					
						
							|  |  |  |         """
 | 
					
						
							|  |  |  |         Tests that unreachable can't be reached. Tests that reachable can be reached if satisfied=True. | 
					
						
							|  |  |  |         Usage: test with satisfied=False, collect requirements into state, test again with satisfied=True | 
					
						
							|  |  |  |         """
 | 
					
						
							|  |  |  |         for location in reachable: | 
					
						
							|  |  |  |             self.assertEqual(self.can_reach_location(location), satisfied, | 
					
						
							|  |  |  |                              f"{location} is unreachable but should be" if satisfied else | 
					
						
							|  |  |  |                              f"{location} is reachable but shouldn't be") | 
					
						
							|  |  |  |         for location in unreachable: | 
					
						
							|  |  |  |             self.assertFalse(self.can_reach_location(location), | 
					
						
							|  |  |  |                              f"{location} is reachable but shouldn't be") |