From f05652d9b89d2ca01a068bc89165f51371d7e614 Mon Sep 17 00:00:00 2001 From: Nicolas Margulies Date: Sun, 10 Jan 2021 22:39:52 +0100 Subject: [PATCH] Fixed tests and reached 100% coverage --- squirrelbattle/entities/player.py | 15 --------------- squirrelbattle/tests/game_test.py | 2 ++ 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/squirrelbattle/entities/player.py b/squirrelbattle/entities/player.py index a241fef..9613618 100644 --- a/squirrelbattle/entities/player.py +++ b/squirrelbattle/entities/player.py @@ -120,21 +120,6 @@ class Player(InventoryHolder, FightingEntity): self.current_xp += int(xp * self.xp_buff) self.level_up() - def remove_from_inventory(self, obj: Item) -> None: - """ - Remove the given item from the inventory, even if the item is equipped. - """ - if obj == self.equipped_main: - self.equipped_main = None - elif obj == self.equipped_armor: - self.equipped_armor = None - elif obj == self.equipped_secondary: - self.equipped_secondary = None - elif obj == self.equipped_helmet: - self.equipped_helmet = None - else: - return super().remove_from_inventory(obj) - # noinspection PyTypeChecker,PyUnresolvedReferences def check_move(self, y: int, x: int, move_if_possible: bool = False) \ -> bool: diff --git a/squirrelbattle/tests/game_test.py b/squirrelbattle/tests/game_test.py index b0d8946..032ff64 100644 --- a/squirrelbattle/tests/game_test.py +++ b/squirrelbattle/tests/game_test.py @@ -49,6 +49,7 @@ class TestGame(unittest.TestCase): # Add items in the inventory to check that it is well loaded bomb.hold(self.game.player) sword.hold(self.game.player) + sword.equip() # Ensure that merchants can be saved merchant = Merchant() @@ -708,6 +709,7 @@ class TestGame(unittest.TestCase): self.assertIn(shield, self.game.player.inventory) self.assertIn(helmet, self.game.player.inventory) self.assertIn(chestplate, self.game.player.inventory) + self.game.display_actions(DisplayActions.REFRESH) # Test rings self.game.player.inventory.clear()