def test_hand_must_be_str(self): with self.assertRaises(TypeError): rotate(self.points, "x", 90, hand=100)
def test_hand_must_be_valid(self): with self.assertRaises(ValueError): rotate(self.points, "x", 90, hand="wrong")
def test_axis_must_be_x_or_y_or_z(self): with self.assertRaises(ValueError): rotate(self.points, "a", 90)
def test_angle_must_be_numeric(self): with self.assertRaises(TypeError): rotate(self.points, "x", "90")
def test_can_switch_handedness(self): self.assertPointsAlmostEqual(rotate(self.points, "x", 90, hand="left"), ((1, 1, -1), (2, 1, -1), (3, 1, -1), (4, 1, -1), (5, 1, -1)))
def test_can_rotate_around_z_axis_90(self): self.assertPointsAlmostEqual(rotate(self.points, "z", 90), ((-1, 1, 1), (-1, 2, 1), (-1, 3, 1), (-1, 4, 1), (-1, 5, 1)))
def test_can_rotate_around_z_axis_180(self): self.assertPointsAlmostEqual(rotate(self.points, "z", 180), ((-1, -1, 1), (-2, -1, 1), (-3, -1, 1), (-4, -1, 1), (-5, -1, 1)))
def test_can_rotate_around_y_axis_90(self): self.assertPointsAlmostEqual(rotate(self.points, "y", 90), ((1, 1, -1), (1, 1, -2), (1, 1, -3), (1, 1, -4), (1, 1, -5)))
def test_can_rotate_around_x_axis_90(self): self.assertPointsAlmostEqual(rotate(self.points, "x", 90), ((1, -1, 1), (2, -1, 1), (3, -1, 1), (4, -1, 1), (5, -1, 1)))