Esempio n. 1
0
    def test_room_traversal(self):
        start_room = OutsideRoom()
        end_room = HallwayRoom()

        start_room.add_exit("north", end_room)

        end_room.add_item(Item("feather"))

        self.assertIn(start_room.about, start_room.describe())
        self.assertTrue(start_room.describe().startswith(start_room.name))

        possible_exits = start_room.possible_exits()
        new_room = start_room.move(possible_exits[0])
        self.assertIsInstance(new_room, Room)
        self.assertEqual(new_room.about, end_room.about)
        self.assertIn(end_room.about, new_room.describe())
        self.assertIn("feather", new_room.describe())

        possible_exits = new_room.possible_exits()
        self.assertEqual(possible_exits, [])