def test_divide_by_scalar(self): point = Point((2, 4)) c = 2 self.assertEqual(point / c, Point((1, 2)))
def test_add(self): p1 = Point((1, 2)) p2 = Point((3, 4)) self.assertEqual(p1 + p2, Point((4, 6)))
def test_subtract(self): p1 = Point((1, 2)) p2 = Point((3, 4)) self.assertEqual(p1 - p2, Point((-2, -2)))
def test_points_folded_on_self_horizontally_joint_angle(self): joint = (Point((0, 0)), Point((0, 1)), Point((0, 0))) self.assertEqualRounded(Point.joint_angle(*joint), pi)
def test_y_getter(self): point = Point((1, 2)) self.assertEqual(point.y, 2)
def test_first_two_points_same_joint_angle(self): joint = (Point((1, 1)), Point((1, 1)), Point((2, 1))) self.assertEqualRounded(Point.joint_angle(*joint), 0)
def test_all_points_same_joint_angle(self): joint = (Point((0, 0)), Point((0, 0)), Point((0, 0))) self.assertEqualRounded(Point.joint_angle(*joint), 0)
def test_colinear_joint_angle(self): joint = (Point((1, 1)), Point((2, 1)), Point((3, 1))) self.assertEqualRounded(Point.joint_angle(*joint), 0)
def test_right_down(self): joint = (Point((0, 0)), Point((1, 0)), Point((1, -1))) self.assertEqualRounded(Point.joint_angle(*joint), pi / 2)
def test_down_left(self): joint = (Point((0, 0)), Point((0, -1)), Point((-1, -1))) self.assertEqualRounded(Point.joint_angle(*joint), pi / 2)
def test_left_up(self): joint = (Point((0, 0)), Point((-1, 0)), Point((-1, 1))) self.assertEqualRounded(Point.joint_angle(*joint), pi / 2)
def test_up_right(self): joint = (Point((0, 0)), Point((0, 1)), Point((1, 1))) self.assertEqualRounded(Point.joint_angle(*joint), pi / 2)