def test_move_forward(self, direction, stop_point): robot = Robot(self.x, self.y, self.asteroid, direction) robot.move_forward() assert robot.x == stop_point[0] assert robot.y == stop_point[1]
def test_check_if_robot_on_asteroid(self, asteroid_size, robot_coordinates): with pytest.raises(MissAsteroidError): asteroid = Asteroid(*asteroid_size) Robot(*robot_coordinates, asteroid, "W")
def test_right(self, current_direction, expected_direction): robot = Robot(self.x, self.y, self.asteroid, current_direction) robot.turn_right() assert robot.direction == expected_direction
def test_move_backward(self, current_direction, steps, expect_pos): robot = Robot(self.x, self.y, self.asteroid, current_direction) robot.move_backward(steps) assert robot.x, robot.y == expect_pos
def test_check_for_obstacles_when_move_backward(self, direction, robot_coordinates): with pytest.raises(ObstaclesOnAsteroidError): robot = Robot(*robot_coordinates, self.asteroid, direction) robot.move_backward()
def test_check_robot_fall_move_backward(self, asteroid_size, robot_coordinates, current_direction): with pytest.raises(RobotFallFromAsteroidError): asteroid = Asteroid(*asteroid_size) robot = Robot(*robot_coordinates, asteroid, *current_direction) robot.move_backward()
def test_move_backward(self, current_direction, current_position, expected_position): robot = Robot(*current_position, self.asteroid, current_direction) robot.move_backward() assert (robot.x, robot.y) == expected_position
def test_check_if_robot_on_asteroid(self, asteroid_size, robot_coordinates, obstacle_position): with pytest.raises(OutsideAsteroidError): asteroid = Asteroid(*asteroid_size) obstacle = Obstacle(*obstacle_position, asteroid) Robot(*robot_coordinates, asteroid, "W", obstacle)
def test_turn_left(self, current_direction, expected_direction): robot = Robot(self.x, self.y, self.asteroid, current_direction, self.obstacle) robot.turn_left() assert robot.direction == expected_direction
def test_robot_in_asteroid(self, direction, x, y, asteroid, current_direction): robot = Robot(x, y, asteroid, current_direction) robot.move_backward robot.move_forward assert robot.x == asteroid.x assert robot.y == asteroid.y
def test_move_backward(self, current_position, expected_position, direction): robot = Robot(self.x, self.y, self.asteroid, self.direction, self.obstacle) robot.move_backward() assert robot.x, robot.y == expected_position
def test_move_backward(self, direction, x, y, asteroid, current_direction): robot = Robot (x, y, asteroid, current_direction) robot.move_backward assert Robot (x, y, asteroid, current_direction) == Robot (x-1, y, asteroid, current_direction)
def test_turn_right(self, current_direction, expected_direction, x, y, asteroid): robot = Robot (x, y, asteroid, current_direction) robot.turn_right("West") assert robot.direction == expected_direction pass
def test_move_backward(self, direction, distance, expected_x, expected_y): robot = Robot(self.x, self.y, self.asteroid, direction) robot.move_backward(distance) assert robot.x == expected_x and robot.y == expected_y
def test_move_forward(self, direction, distance, expected_position): robot = Robot(self.x, self.y, self.asteroid, direction) robot.move_forward(distance) assert robot.x == expected_position or robot.y == expected_position
def test_robot_fall_backward(self, direction, distance, expected_x, expected_y): with pytest.raises(RobotFallError): robot = Robot(self.x, self.y, self.asteroid, direction) robot.move_backward(distance)