def test_if_move_is_legal_raises_exception_when_row_is_equal_or_bigger_than_dungeon_map_length(self): dungeon_map = [['.']] row = len(dungeon_map) column = 0 res = None exp = "\nYou cannot go out of the map." try: move_is_legal(dungeon_map, row, column) except Exception as e: res = str(e) self.assertEqual(res, exp)
def test_if_move_is_legal_exception_raises_when_column_is_negative(self): dungeon_map = [['.']] row = 0 column = -1 res = None exp = "\nYou cannot go out of the map." try: move_is_legal(dungeon_map, row, column) except Exception as e: res = str(e) self.assertEqual(res, exp)
def test_if_move_is_legal_raises_exception_when_position_is_a_wall(self): dungeon_map = [['#']] row = 0 column = 0 res = None exp = "\nThere is a wall. You cannot go there." try: move_is_legal(dungeon_map, row, column) except Exception as e: res = str(e) self.assertEqual(res, exp)
def test_if_move_is_legal_raises_exception_when_position_is_a_spawn_zone(self): dungeon_map = [['S']] row = 0 column = 0 res = None exp = "\nYou cannot enter the Spawn Zone" try: move_is_legal(dungeon_map, row, column) except Exception as e: res = str(e) self.assertEqual(res, exp)