Beispiel #1
0
    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())
Beispiel #2
0
 def test_inventory(self):
     player = Player(gender="male", age="10", hair_color="blue", inventory=[Item("elephant")])
     self.assertIn("an elephant", player.show_inventory())
Beispiel #3
0
 def test_empty_inventory(self):
     player = Player(gender="male", age="10", hair_color="blue")
     self.assertEqual(player.show_inventory(), "You are empty handed.")