def test_check_if_robot_falls_from_asteroid(self, robot_direction, asteroid_size, robot_coordinates): with pytest.raises(RobotHasFallFromAsteroidError): asteroid = Asteroid(*asteroid_size) robot = Robot(*robot_coordinates, asteroid, *robot_direction) robot.move_forward()
def test_if_robot_fell(self): x, y = 10, 15 asteroid = Asteroid(x + 1, y + 1) robot = Robot(x, y, asteroid, "E") with pytest.raises(ValueError): robot.move_forward(100) with pytest.raises(ValueError): robot.move_backward(100)
def test_move_forward(self, current_direction, current_x, current_y, expected_x, expected_y): asteroid = Asteroid(5, 5) robot = Robot(current_x, current_y, asteroid, current_direction) assert robot.x == current_x and robot.y == current_y robot.move_forward() assert robot.x == expected_x and robot.y == expected_y with pytest.raises(MovementError): robot.check_robot_location()
def test_move_forward(self, current_direction, robot_coordinates, expected_coordinates): robot = Robot(*robot_coordinates, self.asteroid, current_direction) robot.move_forward() assert (robot.x, robot.y) == expected_coordinates # check if robot falls from asteroid during movement with pytest.raises(RobotFallsFromAsteroidError): robot.check_robot_falls_from_asteroid() assert robot_coordinates == (robot.x, robot.y)
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()
def test_move_forward(self, current_direction, expected_x, expected_y): robot = Robot(self.x, self.y, self.asteroid, current_direction) assert robot.move_forward() == expected_x + expected_y
def test_move_forward(self, direction, current_position, expected_position): robot = Robot(self.x, self.y, self.direction, self.asteroid) robot.move_forward() assert robot.x, robot.y == expected_position
def test_check_if_robot_can_move_forward(self, direction, robot_coordinates): with pytest.raises(EndAsteroidError): robot = Robot(*robot_coordinates, self.asteroid, direction) robot.move_forward()
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_for_obstacles_when_move_forward(self, direction, robot_coordinates): with pytest.raises(ObstaclesOnAsteroidError): robot = Robot(*robot_coordinates, self.asteroid, direction) robot.move_forward()
def test_move_forward(self, current_direction, steps, expect_pos): robot = Robot(self.x, self.y, self.asteroid, current_direction) robot.move_forward(steps) assert robot.x, robot.y == expect_pos
def test_move_forward(self, current_direction, current_position, expected_position): robot = Robot(*current_position, self.asteroid, current_direction) robot.move_forward() assert (robot.x, robot.y) == expected_position
def test_check_robot_fall_move_forward(self, asteroid_size, robot_coordinates, current_direction): with pytest.raises(RobotFallFromAsteroidError): asteroid = Asteroid(*asteroid_size) robot = Robot(*robot_coordinates, asteroid, *current_direction) robot.move_forward()
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_forward(self, direction, distance, expected_x, expected_y): with pytest.raises(RobotFallError): robot = Robot(self.x, self.y, self.asteroid, direction) robot.move_forward(distance)