示例#1
0
 def test_simple_reflection(self):
     """Test reflecting a shape containing a single point"""
     origin = Point(4, 4)
     x_value, y_value = 7, 6
     shape = Shape.I1(origin)
     self.assertEqual(
         shape.reflect(x=x_value).origin, origin.reflect(x=x_value))
     self.assertEqual(
         shape.reflect(y=y_value).origin, origin.reflect(y=y_value))
     self.assertEqual(
         shape.reflect(x=x_value, y=y_value).origin,
         origin.reflect(x=x_value, y=y_value),
     )
示例#2
0
 def test_reflect_identity(self):
     """Test reflecting a point over itself"""
     point = Point(4, 4)
     x_value, y_value = 4, 4
     reflection = Point(4, 4)
     self.assertEqual(point.reflect(x=x_value, y=y_value), reflection)
示例#3
0
 def test_reflect_y(self):
     """Test reflecting a point over a horizontal line"""
     point = Point(4, 4)
     y_value = 1
     reflection = Point(4, -2)
     self.assertEqual(point.reflect(y=y_value), reflection)
示例#4
0
 def test_reflect_xy(self):
     """Test reflecting a point over a horizontal and vertical lines"""
     point = Point(4, 4)
     x_value, y_value = 7, 1
     reflection = Point(10, -2)
     self.assertEqual(point.reflect(x=x_value, y=y_value), reflection)
示例#5
0
 def test_reflect_x(self):
     """Test reflecting a point over a vertical line"""
     point = Point(4, 4)
     x_value = 7
     reflection = Point(10, 4)
     self.assertEqual(point.reflect(x=x_value), reflection)