Tests: use strict equality in some tests # (#2778)

* Tests: replace .assertLess/GreaterEqual() with .assertEqual() in two tests where strict equality seems more correct
This commit is contained in:
Ixrec 2024-01-30 08:00:47 +00:00 committed by GitHub
parent dc49d50c2c
commit 144769a141
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 8 deletions

View File

@ -43,15 +43,15 @@ class TestBase(unittest.TestCase):
with self.subTest(group_name, group_name=group_name):
self.assertNotIn(group_name, world_type.item_name_to_id)
def test_item_count_greater_equal_locations(self):
"""Test that by the pre_fill step under default settings, each game submits items >= locations"""
def test_item_count_equal_locations(self):
"""Test that by the pre_fill step under default settings, each game submits items == locations"""
for game_name, world_type in AutoWorldRegister.world_types.items():
with self.subTest("Game", game=game_name):
multiworld = setup_solo_multiworld(world_type)
self.assertGreaterEqual(
self.assertEqual(
len(multiworld.itempool),
len(multiworld.get_unfilled_locations()),
f"{game_name} Item count MUST meet or exceed the number of locations",
f"{game_name} Item count MUST match the number of locations",
)
def test_items_in_datapackage(self):

View File

@ -11,14 +11,14 @@ class TestBase(unittest.TestCase):
multiworld = setup_solo_multiworld(world_type)
locations = Counter(location.name for location in multiworld.get_locations())
if locations:
self.assertLessEqual(locations.most_common(1)[0][1], 1,
f"{world_type.game} has duplicate of location name {locations.most_common(1)}")
self.assertEqual(locations.most_common(1)[0][1], 1,
f"{world_type.game} has duplicate of location name {locations.most_common(1)}")
locations = Counter(location.address for location in multiworld.get_locations()
if type(location.address) is int)
if locations:
self.assertLessEqual(locations.most_common(1)[0][1], 1,
f"{world_type.game} has duplicate of location ID {locations.most_common(1)}")
self.assertEqual(locations.most_common(1)[0][1], 1,
f"{world_type.game} has duplicate of location ID {locations.most_common(1)}")
def test_locations_in_datapackage(self):
"""Tests that created locations not filled before fill starts exist in the datapackage."""