| 
									
										
										
										
											2024-01-12 01:07:40 +01:00
										 |  |  | from test.bases 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] = (), | 
					
						
							| 
									
										
										
										
											2024-01-15 09:17:46 +01:00
										 |  |  |                                    satisfied: bool = True) -> None: | 
					
						
							| 
									
										
										
										
											2023-10-08 17:27:05 +02:00
										 |  |  |         """
 | 
					
						
							|  |  |  |         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") | 
					
						
							| 
									
										
										
										
											2024-01-12 01:07:40 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-15 09:17:46 +01:00
										 |  |  |     def testRocketPartsExist(self) -> None: | 
					
						
							| 
									
										
										
										
											2024-01-12 01:07:40 +01:00
										 |  |  |         """Tests that rocket parts exist and are unique""" | 
					
						
							|  |  |  |         self.assertEqual(len(self.get_items_by_name("Gauge")), 1) | 
					
						
							|  |  |  |         self.assertEqual(len(self.get_items_by_name("Wheel")), 1) | 
					
						
							|  |  |  |         diamond_eyes = self.get_items_by_name("Diamond Eye") | 
					
						
							|  |  |  |         self.assertEqual(len(diamond_eyes), 3) | 
					
						
							|  |  |  |         # verify diamond eyes are individual items | 
					
						
							|  |  |  |         self.assertFalse(diamond_eyes[0] is diamond_eyes[1]) | 
					
						
							|  |  |  |         self.assertFalse(diamond_eyes[0] is diamond_eyes[2]) | 
					
						
							|  |  |  |         self.assertFalse(diamond_eyes[1] is diamond_eyes[2]) |