* SoE: fix typing for tests * SoE: explicitly export pyevermizer To support loading the module from source (rather than module) we import pyevermizer from `__init__.py` in other files. This has been an implicit export and `mypy --strict` disables implicit exports, so we export it explicitly now. * SoE: fix style in patch.py * SoE: remove unused imports * SoE: fix format mistakes * SoE: cleaner typing in SoEOptions.flags as suggested by beauxq
		
			
				
	
	
		
			32 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
from test.bases import WorldTestBase
 | 
						|
from typing import Iterable
 | 
						|
 | 
						|
 | 
						|
class SoETestBase(WorldTestBase):
 | 
						|
    game = "Secret of Evermore"
 | 
						|
 | 
						|
    def assertLocationReachability(self, reachable: Iterable[str] = (), unreachable: Iterable[str] = (),
 | 
						|
                                   satisfied: bool = 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")
 | 
						|
 | 
						|
    def testRocketPartsExist(self) -> None:
 | 
						|
        """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])
 |