def test_check_if_robot_on_asteroid(self, asteroid_size, robot_obstacle_coordinates): obstacle = Obstacle(*robot_obstacle_coordinates) asteroid = Asteroid(*asteroid_size) robot = Robot(*robot_obstacle_coordinates, asteroid, "W") with pytest.raises(MissAsteroidError): asteroid.check_obstacle_position(obstacle) robot.check_position_on_asteroid() with pytest.raises(ObstacleCrashError): asteroid.add_obstacle(obstacle) robot.check_for_block()
def test_move_forward(self, current_direction, current_x, current_y, expected_x, expected_y): obstacle = Obstacle(expected_x, expected_y) self.asteroid.add_obstacle(obstacle) robot = Robot(current_x, current_y, self.asteroid, current_direction) robot.move_forward() assert robot.x == expected_x and robot.y == expected_y # Check if it try to falls from asteroid during movement or get obstacle with pytest.raises(MissAsteroidError): robot.check_position_on_asteroid() with pytest.raises(ObstacleCrashError): robot.check_for_block()