Tests: add create_item test
This commit is contained in:
		
							parent
							
								
									43323e59ce
								
							
						
					
					
						commit
						ec9ef21cc0
					
				| 
						 | 
					@ -2,7 +2,7 @@ colorama>=0.4.4
 | 
				
			||||||
websockets>=10.0
 | 
					websockets>=10.0
 | 
				
			||||||
PyYAML>=6.0
 | 
					PyYAML>=6.0
 | 
				
			||||||
fuzzywuzzy>=0.18.0
 | 
					fuzzywuzzy>=0.18.0
 | 
				
			||||||
prompt_toolkit>=3.0.20
 | 
					prompt_toolkit>=3.0.22
 | 
				
			||||||
appdirs>=1.4.4
 | 
					appdirs>=1.4.4
 | 
				
			||||||
jinja2>=3.0.2
 | 
					jinja2>=3.0.3
 | 
				
			||||||
schema>=0.7.4
 | 
					schema>=0.7.4
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,12 @@
 | 
				
			||||||
 | 
					import unittest
 | 
				
			||||||
 | 
					from worlds.AutoWorld import AutoWorldRegister
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class TestBase(unittest.TestCase):
 | 
				
			||||||
 | 
					    def testCreateItem(self):
 | 
				
			||||||
 | 
					        for game_name, world_type in AutoWorldRegister.world_types.items():
 | 
				
			||||||
 | 
					            proxy_world = world_type(None, 0)  # this is identical to MultiServer.py creating worlds
 | 
				
			||||||
 | 
					            for item_name in world_type.item_name_to_id:
 | 
				
			||||||
 | 
					                with self.subTest("Create Item", item_name=item_name, game_name=game_name):
 | 
				
			||||||
 | 
					                    item = proxy_world.create_item(item_name)
 | 
				
			||||||
 | 
					                    self.assertEqual(item.name, item_name)
 | 
				
			||||||
| 
						 | 
					@ -6,7 +6,6 @@ from worlds.AutoWorld import AutoWorldRegister
 | 
				
			||||||
from . import setup_default_world
 | 
					from . import setup_default_world
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TestBase(unittest.TestCase):
 | 
					class TestBase(unittest.TestCase):
 | 
				
			||||||
    _state_cache = {}
 | 
					 | 
				
			||||||
    gen_steps = ["generate_early", "create_regions", "create_items", "set_rules", "generate_basic", "pre_fill"]
 | 
					    gen_steps = ["generate_early", "create_regions", "create_items", "set_rules", "generate_basic", "pre_fill"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def testAllStateCanReachEverything(self):
 | 
					    def testAllStateCanReachEverything(self):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,12 +1,8 @@
 | 
				
			||||||
import unittest
 | 
					import unittest
 | 
				
			||||||
from BaseClasses import MultiWorld
 | 
					 | 
				
			||||||
from worlds.AutoWorld import AutoWorldRegister
 | 
					from worlds.AutoWorld import AutoWorldRegister
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TestBase(unittest.TestCase):
 | 
					class TestBase(unittest.TestCase):
 | 
				
			||||||
    world: MultiWorld
 | 
					 | 
				
			||||||
    _state_cache = {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def testUniqueItems(self):
 | 
					    def testUniqueItems(self):
 | 
				
			||||||
        known_item_ids = set()
 | 
					        known_item_ids = set()
 | 
				
			||||||
        for gamename, world_type in AutoWorldRegister.world_types.items():
 | 
					        for gamename, world_type in AutoWorldRegister.world_types.items():
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue