Skip to content

Commit

Permalink
Tests: use strict equality in some tests # (#2778)
Browse files Browse the repository at this point in the history
* Tests: replace .assertLess/GreaterEqual() with .assertEqual() in two tests where strict equality seems more correct
  • Loading branch information
Ixrec authored Jan 30, 2024
1 parent dc49d50 commit 144769a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions test/general/test_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ def test_item_name_group_conflict(self):
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):
Expand Down
8 changes: 4 additions & 4 deletions test/general/test_locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ def test_create_duplicate_locations(self):
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."""
Expand Down

0 comments on commit 144769a

Please sign in to comment.