Tests: datapackage and more multiworld renaming (#1454)

* Tests: add a test that created items and locations exist in the datapackage

* move FF validation to `assert_generate` and remove test exclusion

* test created location addresses are correct

* make the assertion proper and more verbose

* make item count test ~~a bit faster~~ a lot nicer

* 120 blaze it

* name test multiworld setup better and fix another over 120 line in FFR
This commit is contained in:
alwaysintreble
2023-02-15 15:46:10 -06:00
committed by GitHub
parent f078750b72
commit 8af7908cd0
6 changed files with 47 additions and 32 deletions

View File

@@ -1,6 +1,6 @@
import unittest
from worlds.AutoWorld import AutoWorldRegister
from . import setup_default_world
from . import setup_solo_multiworld
class TestBase(unittest.TestCase):
@@ -43,14 +43,18 @@ class TestBase(unittest.TestCase):
def testItemCountGreaterEqualLocations(self):
for game_name, world_type in AutoWorldRegister.world_types.items():
if game_name in {"Final Fantasy"}:
continue
with self.subTest("Game", game=game_name):
world = setup_default_world(world_type)
location_count = sum(0 if location.event or location.item else 1 for location in world.get_locations())
multiworld = setup_solo_multiworld(world_type)
self.assertGreaterEqual(
len(world.itempool),
location_count,
f"{game_name} Item count MUST meet or exceede the number of locations",
len(multiworld.itempool),
len(multiworld.get_unfilled_locations()),
f"{game_name} Item count MUST meet or exceed the number of locations",
)
def testItemsInDatapackage(self):
"""Test that any created items in the itempool are in the datapackage"""
for game_name, world_type in AutoWorldRegister.world_types.items():
with self.subTest("Game", game=game_name):
multiworld = setup_solo_multiworld(world_type)
for item in multiworld.itempool:
self.assertIn(item.name, world_type.item_name_to_id)