def test_filled_constructor_should_create_valid_object(): random = Pose.random() pose = Pose(x=random.x, y=random.y, angle=random.angle) assert pose is not None assert pose.x == random.x assert pose.y == random.y assert pose.angle == random.angle
def __build_debug(self, state): debug = Debug() debug.clean() for robot in state.team_yellow: debug.step_points.append(Point(robot.x + 10, robot.y + 10)) debug.final_poses.append(Pose(state.ball.x + 10, state.ball.y + 10, 10))
def test_rand_should_create_an_valid_object(): pose = Pose.random() assert pose is not None assert pose.x is not None assert pose.y is not None assert pose.angle is not None
def test_default_constructor_should_create_zero_object(): pose = Pose() assert pose is not None assert pose.x == 0 assert pose.y == 0 assert pose.angle == 0
def __build_debug(self, robots_points): debug = Debug() debug.clean() for robot_points in robots_points: points = robot_points["step_points"] end_pose = robot_points["end_pose"] for point in points: debug.step_points.append(Point(point[0], point[1])) debug.final_poses.append( Pose(end_pose[0], end_pose[1] + end_pose[2]))
def random(cls): qtd_step_points = randint(2, 10) qtd_final_poses = randint(2, 10) qtd_paths = randint(2, 10) step_points = [Point.random() for i in range(1, qtd_step_points)] final_poses = [Pose.random() for i in range(1, qtd_final_poses)] paths = [Path.random() for i in range(1, qtd_paths)] return cls(step_points=step_points, final_poses=final_poses, paths=paths)
def test_eq_should_be_true_if_all_parameters_are_equal(): pose1 = Pose.random() pose2 = Pose(x=pose1.x, y=pose1.y, angle=pose1.angle) assert pose1 == pose2 pose2.x = pose2.x + 1 assert pose1 != pose2 pose2.x = pose2.x - 1 pose2.y = pose2.y + 1 assert pose1 != pose2 pose2.y = pose2.y - 1 pose2.angle = pose2.angle + 1 assert pose1 != pose2