Fixed tests and reached 100% coverage
This commit is contained in:
parent
519504fc32
commit
f05652d9b8
|
@ -120,21 +120,6 @@ class Player(InventoryHolder, FightingEntity):
|
||||||
self.current_xp += int(xp * self.xp_buff)
|
self.current_xp += int(xp * self.xp_buff)
|
||||||
self.level_up()
|
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
|
# noinspection PyTypeChecker,PyUnresolvedReferences
|
||||||
def check_move(self, y: int, x: int, move_if_possible: bool = False) \
|
def check_move(self, y: int, x: int, move_if_possible: bool = False) \
|
||||||
-> bool:
|
-> bool:
|
||||||
|
|
|
@ -49,6 +49,7 @@ class TestGame(unittest.TestCase):
|
||||||
# Add items in the inventory to check that it is well loaded
|
# Add items in the inventory to check that it is well loaded
|
||||||
bomb.hold(self.game.player)
|
bomb.hold(self.game.player)
|
||||||
sword.hold(self.game.player)
|
sword.hold(self.game.player)
|
||||||
|
sword.equip()
|
||||||
|
|
||||||
# Ensure that merchants can be saved
|
# Ensure that merchants can be saved
|
||||||
merchant = Merchant()
|
merchant = Merchant()
|
||||||
|
@ -708,6 +709,7 @@ class TestGame(unittest.TestCase):
|
||||||
self.assertIn(shield, self.game.player.inventory)
|
self.assertIn(shield, self.game.player.inventory)
|
||||||
self.assertIn(helmet, self.game.player.inventory)
|
self.assertIn(helmet, self.game.player.inventory)
|
||||||
self.assertIn(chestplate, self.game.player.inventory)
|
self.assertIn(chestplate, self.game.player.inventory)
|
||||||
|
self.game.display_actions(DisplayActions.REFRESH)
|
||||||
|
|
||||||
# Test rings
|
# Test rings
|
||||||
self.game.player.inventory.clear()
|
self.game.player.inventory.clear()
|
||||||
|
|
Loading…
Reference in New Issue