def test_drop_inventory_item(self): """ test that dropping an item leaves the item in the current location """ player = Player(gender="male", age="10", hair_color="blue", inventory=[Item("elephant")]) self.assertIn("an elephant", player.show_inventory()) player.location = OutsideRoom() self.assertNotIn("an elephant", player.location.show_items()) player.drop("elephant") self.assertNotIn("an elephant", player.show_inventory()) self.assertIn("elephant", player.location.show_items())
def test_inventory(self): player = Player(gender="male", age="10", hair_color="blue", inventory=[Item("elephant")]) self.assertIn("an elephant", player.show_inventory())
def test_empty_inventory(self): player = Player(gender="male", age="10", hair_color="blue") self.assertEqual(player.show_inventory(), "You are empty handed.")