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,16 +1,25 @@
import unittest
from collections import Counter
from worlds.AutoWorld import AutoWorldRegister
from . import setup_default_world
from . import setup_solo_multiworld
class TestBase(unittest.TestCase):
def testCreateDuplicateLocations(self):
"""Tests that no two Locations share a name."""
for game_name, world_type in AutoWorldRegister.world_types.items():
if game_name in {"Final Fantasy"}:
continue
multiworld = setup_default_world(world_type)
multiworld = setup_solo_multiworld(world_type)
locations = Counter(multiworld.get_locations())
if locations:
self.assertLessEqual(locations.most_common(1)[0][1], 1,
f"{world_type.game} has duplicate of location {locations.most_common(1)}")
def testLocationsInDatapackage(self):
"""Tests that created locations not filled before fill starts exist in the datapackage."""
for game_name, world_type in AutoWorldRegister.world_types.items():
with self.subTest("Game", game_name=game_name):
multiworld = setup_solo_multiworld(world_type)
locations = multiworld.get_unfilled_locations() # do unfilled locations to avoid Events
for location in locations:
self.assertIn(location.name, world_type.location_name_to_id)
self.assertEqual(location.address, world_type.location_name_to_id[location.name])