class TestLocation(TestCase):
    def setUp(self):
        self.my_location = Location("My location")

    def test_look(self):
        self.assertEqual(self.my_location.look(), 'My location', 'Unexpected description')
        self.my_dog = Item("dog", "my pet dog", True)
        self.my_location.add_item(self.my_dog)
        self.assertEqual(self.my_location.look(), "My location\nYou can see:\n\tmy pet dog\n",
            "Look did not work as expected")
        print(self.my_location.look())

        self.my_cat = Item("cat", "a stray cat", True)
        self.my_location.add_item(self.my_cat)
        self.assertEqual(self.my_location.look(), "My location\nYou can see:\n\tmy pet dog\n\ta stray cat\n",
            "Look did not work as expected")
        print(self.my_location.look())

    def test_go(self):
        self.north_location = Location('North location')
        self.my_location.exits = {'N': self.north_location}
        self.assertEqual(self.my_location.go('N'), self.north_location, "Go didn't work as expected")

    def test_get_exits(self):
        self.my_location.exits = {'N': 1, 'S': 2}
        self.assertEquals(self.my_location.get_exits(), 'N S ', 'Unexpected exits list')

    def test_has_exit(self):
        self.my_location.exits = {'N': 1, 'S': 2}
        self.assertTrue(self.my_location.has_exit('N'), 'Expected North to return true')
        self.assertFalse(self.my_location.has_exit('E'), 'Expected East to return false')

    def test_get_items(self):
        my_dog = Item("Dog", "A friendly dalmatian.", True)
        self.my_location.add_item(my_dog)
        self.my_location.get_items()

    def test_add_item(self):
        self.my_dog = Item("dog", "my pet dog", True)
        self.my_location.add_item(self.my_dog)
        self.assertEqual(len(self.my_location.items), 1, "Item list is wrong length")
        self.assertEqual(self.my_location.items[0].description, "my pet dog", "Item description wrong")

    def test_remove_item(self):
        self.my_dog = Item("dog", "my pet dog", True)
        self.my_location.add_item(self.my_dog)
        self.assertEqual(len(self.my_location.items), 1, "Item list is wrong length")
        self.assertEqual(self.my_location.items[0].description, "my pet dog", "Item description wrong")
        self.my_location.remove_item(self.my_dog)
        self.assertEqual(len(self.my_location.items), 0, "Item list is wrong length")