def test_remove_exit(self): level = LevelBuilder().create_level(20, 10)\ .add_item("key", (8,4))\ .add_item("key", (10,2))\ .add_item("exit", (8, 2))\ .add_room((5,1), 7, 5, {(11,3)}).build() actual = str(level) expected = "....................\n" \ ".....WWWWWWW........\n" \ ".....W E KW........\n" \ ".....W D........\n" \ ".....W K W........\n" \ ".....WWWWWWW........\n" \ "....................\n" \ "....................\n" \ "....................\n" \ "...................." level.remove_item("exit", (8, 2)) self.assertEqual(actual, expected, "Room Creation Failed.") actual = str(level) expected = "....................\n" \ ".....WWWWWWW........\n" \ ".....W KW........\n" \ ".....W D........\n" \ ".....W K W........\n" \ ".....WWWWWWW........\n" \ "....................\n" \ "....................\n" \ "....................\n" \ "...................." self.assertEqual(actual, expected, "Exit Removal Failed.")
def test_remove_item_invalid_location(self): level = LevelBuilder().create_level(20, 10)\ .add_item("key", (8,4))\ .add_item("key", (10,2))\ .add_item("exit", (8, 2))\ .add_room((5,1), 7, 5, {(11,3)}).build() actual = str(level) expected = "....................\n" \ ".....WWWWWWW........\n" \ ".....W E KW........\n" \ ".....W D........\n" \ ".....W K W........\n" \ ".....WWWWWWW........\n" \ "....................\n" \ "....................\n" \ "....................\n" \ "...................." with self.assertRaises(KeyError): level.remove_item("key", (9, 4))