コード例 #1
0
 def test_hand_must_be_str(self):
     with self.assertRaises(TypeError):
         rotate(self.points, "x", 90, hand=100)
コード例 #2
0
 def test_hand_must_be_valid(self):
     with self.assertRaises(ValueError):
         rotate(self.points, "x", 90, hand="wrong")
コード例 #3
0
 def test_axis_must_be_x_or_y_or_z(self):
     with self.assertRaises(ValueError):
         rotate(self.points, "a", 90)
コード例 #4
0
 def test_angle_must_be_numeric(self):
     with self.assertRaises(TypeError):
         rotate(self.points, "x", "90")
コード例 #5
0
 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)))
コード例 #6
0
 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)))
コード例 #7
0
 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)))
コード例 #8
0
 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)))
コード例 #9
0
 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)))