def test_remove_item(self): test_item_one = Item(name="Test_Item_One", weight=2) test_item_two = Item(name="Test_Item_Two", weight=4) test_item_three = Item(name="Test_Item_Three", weight=8) test_inventory = [test_item_one, test_item_two, test_item_three] test_player = Player(items=test_inventory) self.assertEqual(test_player.get_items(), test_inventory) test_player.remove_item(test_item_one) self.assertNotIn(test_item_one, test_player.get_items()) test_player.remove_item(test_item_two) self.assertNotIn(test_item_two, test_player.get_items()) test_player.remove_item(test_item_three) self.assertNotIn(test_item_three, test_player.get_items())
def test_set_items(self): test_item_one = Item(name="Test_Item_One", weight=2) test_item_two = Item(name="Test_Item_Two", weight=4) test_item_three = Item(name="Test_Item_Three", weight=8) test_player = Player() test_list = [test_item_one] test_player.set_items(test_list) self.assertEqual(test_player.get_items(), test_list) test_list = [test_item_one, test_item_two] test_player.set_items(test_list) self.assertEqual(test_player.get_items(), test_list) test_list = [test_item_one, test_item_two, test_item_three] test_player.set_items(test_list) self.assertEqual(test_player.get_items(), test_list)