From 6c908de13f95818b22766eff4ce4f7b2308a2be4 Mon Sep 17 00:00:00 2001 From: el-u <109771707+el-u@users.noreply.github.com> Date: Sat, 29 Jul 2023 19:54:48 +0200 Subject: [PATCH] core: add a test to verify that fill_restrictive removes the exact same item from the item_pool that it has used to fill --- test/general/TestFill.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/general/TestFill.py b/test/general/TestFill.py index 66fc3b2f..99f48cd0 100644 --- a/test/general/TestFill.py +++ b/test/general/TestFill.py @@ -433,6 +433,20 @@ class TestFillRestrictive(unittest.TestCase): self.assertTrue(multi_world.state.prog_items[item.name, item.player], "Sweep did not collect - Test flawed") self.assertEqual(multi_world.state.prog_items[item.name, item.player], 1, "Sweep collected multiple times") + def test_correct_item_instance_removed_from_pool(self): + multi_world = generate_multi_world() + player1 = generate_player_data(multi_world, 1, 2, 2) + + player1.prog_items[0].name = "Different_item_instance_but_same_item_name" + player1.prog_items[1].name = "Different_item_instance_but_same_item_name" + loc0 = player1.locations[0] + + fill_restrictive(multi_world, multi_world.state, + [loc0], player1.prog_items) + + self.assertEqual(1, len(player1.prog_items)) + self.assertIsNot(loc0.item, player1.prog_items[0], "Filled item was still present in item pool") + class TestDistributeItemsRestrictive(unittest.TestCase): def test_basic_distribute(self):