def test_move_down(self): map.read_map('map\map.txt') direction = 'down' map.set_object(self.player.position, self.player) maybe_new_position = list(self.player.position) maybe_new_position[1] += self.player.step self.player.move(direction) self.assertEqual(map.get_object(maybe_new_position), map.get_object(self.player.position))
def test_move_bonus(self): map.read_map('map\map.txt') direction = 'right' self.player.position = [1, 1] bonus = Bonus([2, 1]) map.set_object(self.player.position, self.player) map.set_object(bonus.position, bonus) maybe_new_position = list(self.player.position) maybe_new_position[0] += self.player.step self.player.move(direction) self.assertEqual(map.get_object(maybe_new_position), map.get_object(self.player.position))
def test_move_wall(self): map.read_map('map\map.txt') direction = 'left' self.player.position = [1, 1] map.set_object(self.player.position, self.player) default_position = self.player.position maybe_new_position = list(self.player.position) maybe_new_position[0] -= self.player.step self.player.move(direction) self.assertEqual(map.get_object(default_position), map.get_object(self.player.position))
def test_move_enemy(self): map.read_map('map\map.txt') direction = 'right' self.player.position = [1, 1] enemy = Lower([2, 1]) map.set_object(self.player.position, self.player) map.set_object(enemy.position, enemy) default_position = self.player.position maybe_new_position = list(self.player.position) maybe_new_position[0] += self.player.step self.player.move(direction) self.assertEqual(map.get_object(default_position), map.get_object(self.player.position))
def test_move_bomb(self): map.read_map('map\map.txt') direction = 'right' self.player.position = [1, 1] self.simple_bomb.position = [2, 1] map.set_object(self.player.position, self.player) map.set_object(self.simple_bomb.position, self.simple_bomb) default_position = self.player.position maybe_new_position = list(self.player.position) maybe_new_position[0] += self.player.step self.player.move(direction) self.assertEqual(map.get_object(default_position), map.get_object(self.player.position))