Пример #1
0
 def test_for_line_and_line(self):
     """testing if a given infinite line is located inisde another
     given infinite line which should always return False
     """
     
     line1 = shapes.Line(1, 0)
     line2 = shapes.Line(1, 1)
     self.assertFalse(operations.is_inside(line1, line2))
Пример #2
0
 def test_for_circle_and_point(self):
     """testing if a given circle is located inside a given point
     which should always return False
     """
     
     circle = shapes.Circle(shapes.Point(0, 0), 1)
     point = shapes.Point(0, 0)
     self.assertFalse(operations.is_inside(circle, point))
Пример #3
0
 def test_for_line_and_point(self):
     """testing if a given infinite line is located inside a given
     point which should always return False
     """
     
     line = shapes.Line(1, 0)
     point = shapes.Point(0, 0)
     self.assertFalse(operations.is_inside(line, point))
Пример #4
0
 def test_for_circle_and_circle5(self):
     """the fifth test for checking if a given circle is located
     inside another given circle with them intersecting
     """
     
     circle1 = shapes.Circle(shapes.Point(0, 0), 1)
     circle2 = shapes.Circle(shapes.Point(10, 0), 1)
     self.assertFalse(operations.is_inside(circle1, circle2))
Пример #5
0
 def test_for_point_and_line(self):
     """testing if a given point is located inside a given infinite
     line
     """
     
     point = shapes.Point(0, 0)
     line = shapes.Line(0, 0)
     self.assertFalse(operations.is_inside(point, line))
Пример #6
0
 def test_for_circle_and_line(self):
     """testing if a given circle is located inside a given
     inifinite line which should always return False
     """
     
     circle = shapes.Circle(shapes.Point(0, 0), 1)
     line = shapes.Line(1, 0)
     self.assertFalse(operations.is_inside(circle, line))
Пример #7
0
 def test_for_point_and_point(self):
     """testing if a point is located inside another point with the
     same coordinates
     """
     
     point1 = shapes.Point(0, 0)
     point2 = shapes.Point(0, 0)
     self.assertFalse(operations.is_inside(point1, point2))
Пример #8
0
 def test_for_point_and_circle1(self):
     """the first test for checking if a given point is inside a
     given circle, with the point being located inside the circle
     """
     
     point = shapes.Point(0, 0)
     circle = shapes.Circle(shapes.Point(0, 0), 1)
     self.assertTrue(operations.is_inside(point, circle))
Пример #9
0
 def test_for_point_and_circle3(self):
     """the third test for checking if a given point is inside a
     given circle with the point being located outside the circle
     """
     
     point = shapes.Point(5, 5)
     circle = shapes.Circle(shapes.Point(0, 0), 1)
     self.assertFalse(operations.is_inside(point, circle))
Пример #10
0
 def test_for_circle_and_circle2(self):
     """the second test for checking if a given circle is located
     inside another given circle with them fully overlap each other
     """
     
     circle1 = shapes.Circle(shapes.Point(0, 0), 1)
     circle2 = shapes.Circle(shapes.Point(0, 0), 1)
     self.assertFalse(operations.is_inside(circle1, circle2))
Пример #11
0
 def test_for_circle_and_circle3(self):
     """the third test for checking if a given circle is located
     inside another given circle with the second one being inside
     the first one
     """
     
     circle1 = shapes.Circle(shapes.Point(0, 0), 2)
     circle2 = shapes.Circle(shapes.Point(0, 0), 1)
     self.assertFalse(operations.is_inside(circle1, circle2))
Пример #12
0
 def test_for_point_and_circle2(self):
     """the second test for checking if a given point is inside a
     given circle, with the point being located on the perimeter of
     the circle
     """
     
     point = shapes.Point(0, -1)
     circle = shapes.Circle(shapes.Point(0, 0), 1)
     self.assertFalse(operations.is_inside(point, circle))
Пример #13
0
 def test_for_linesegment_and_circle4(self):
     """the fourth test for checking if a given line segment is
     located inside a given circle with them being fully apart
     """
     
     end1 = shapes.Point(10, 10)
     end2 = shapes.Point(11, 11)
     line = shapes.LineSegment(end1, end2)
     circle = shapes.Circle(shapes.Point(0, 0), 1)
     self.assertFalse(operations.is_inside(line, circle))
Пример #14
0
 def test_for_point_and_linesegment(self):
     """testing if a given point is located inside a given line
     segment
     """
     
     point = shapes.Point(0, 0)
     end1 = shapes.Point(0, 1)
     end2 = shapes.Point(0, -1)
     line = shapes.LineSegment(end1, end2)
     self.assertFalse(operations.is_inside(point, line))
Пример #15
0
 def test_for_linesegment_and_line(self):
     """testing if a given line segment is located inside a given
     infinite line which should always return False
     """
     
     end1 = shapes.Point(0, 0)
     end2 = shapes.Point(1, 1)
     line1 = shapes.LineSegment(end1, end2)
     line2 = shapes.Line(1, 0)
     self.assertFalse(operations.is_inside(line1, line2))
Пример #16
0
 def test_for_linesegment_and_circle3(self):
     """the third test for checking if a given line segment is
     located inside a given circle with them intersecting each other
     """
     
     end1 = shapes.Point(0, 0)
     end2 = shapes.Point(3, 3)
     line = shapes.LineSegment(end1, end2)
     circle = shapes.Circle(shapes.Point(0, 0), 1)
     self.assertFalse(operations.is_inside(line, circle))
Пример #17
0
 def test_for_circle_and_linesegment(self):
     """testing if a given circle is located inside a given line
     segment which should always return False
     """
     
     circle = shapes.Circle(shapes.Point(0, 0), 1)
     end1 = shapes.Point(0, 0)
     end2 = shapes.Point(1, 1)
     line = shapes.LineSegment(end1, end2)
     self.assertFalse(operations.is_inside(circle, line))
Пример #18
0
 def test_for_linesegment_and_point(self):
     """testing if a given line segment is located inside a given
     point which should always return False
     """
     
     end1 = shapes.Point(0, 0)
     end2 = shapes.Point(1, 1)
     line = shapes.LineSegment(end1, end2)
     point = shapes.Point(0, 0)
     self.assertFalse(operations.is_inside(line, point))
Пример #19
0
 def test_for_linesegment_and_circle1(self):
     """the first test for checking if a given line segment is
     located inside a given circle with the line segment being
     fully inside the circle
     """
     
     end1 = shapes.Point(0, 0)
     end2 = shapes.Point(0, 0.4)
     line = shapes.LineSegment(end1, end2)
     circle = shapes.Circle(shapes.Point(0, 0), 1)
     self.assertTrue(operations.is_inside(line, circle))
Пример #20
0
 def test_for_line_and_polygon(self):
     """testing if a given infinite line is located inside a given
     polygon which should always return False
     """
     
     line = shapes.Line(1, 0)
     v1 = shapes.Point(0, 0)
     v2 = shapes.Point(0, 1)
     v3 = shapes.Point(1, 1)
     pol = shapes.Polygon(v1, v2, v3)
     self.assertFalse(operations.is_inside(line, pol))
Пример #21
0
 def test_for_rectangle_and_point(self):
     """test for checking if a given rectangle is located inside a
     given point which should always return False
     """
     
     v1 = shapes.Point(-1, -1)
     v2 = shapes.Point(1, -1)
     v3 = shapes.Point(1, 1)
     v4 = shapes.Point(-1, 1)
     rec = shapes.Rectangle(v1, v2, v3, v4)
     point = shapes.Point(0, 0)
     self.assertFalse(operations.is_inside(rec, point))
Пример #22
0
 def test_for_line_and_rectangle(self):
     """testing if a given infinite line is located inside a given
     rectangle which should always return False
     """
     
     line = shapes.Line(1, 0)
     v1 = shapes.Point(-1, -1)
     v2 = shapes.Point(1, -1)
     v3 = shapes.Point(1, 1)
     v4 = shapes.Point(-1, 1)
     rec = shapes.Rectangle(v1, v2, v3, v4)
     self.assertFalse(operations.is_inside(line, rec))
Пример #23
0
 def test_for_linesegment_and_circle2(self):
     """the second test for checking if a given line segment is
     located inisde a given circle with the line segment being
     inside the circle but with one of its ends touching the
     circle's perimeter
     """
     
     end1 = shapes.Point(0, 0)
     end2 = shapes.Point(0, 1)
     line = shapes.LineSegment(end1, end2)
     circle = shapes.Circle(shapes.Point(0, 0), 1)
     self.assertFalse(operations.is_inside(line, circle))
Пример #24
0
 def test_for_rectangle_and_line(self):
     """testing if a given rectangle is located insied a given
     infinite line which should always return False
     """
     
     v1 = shapes.Point(-2, 0)
     v2 = shapes.Point(0, -2)
     v3 = shapes.Point(2, 0)
     v4 = shapes.Point(0, 2)
     rec = shapes.Rectangle(v1, v2, v3, v4)
     line = shapes.Line(1, 0)
     self.assertFalse(operations.is_inside(rec, line))
Пример #25
0
 def test_for_rectangle_and_circle5(self):
     """the fifth test for checking if a given rectangle is located
     inside a given circle with them being fully apart
     """
     
     v1 = shapes.Point(-2, 0)
     v2 = shapes.Point(0, -2)
     v3 = shapes.Point(2, 0)
     v4 = shapes.Point(0, 2)
     rec = shapes.Rectangle(v1, v2, v3, v4)
     circle = shapes.Circle(shapes.Point(5, 5), 1)
     self.assertFalse(operations.is_inside(rec, circle))
Пример #26
0
 def test_for_circle_and_rectangle4(self):
     """the fourth test for checking if a given circle is located
     inside a given rectangle with them being fully apart
     """
     
     circle = shapes.Circle(shapes.Point(10, 10), 1)
     v1 = shapes.Point(-2, -2)
     v2 = shapes.Point(2, -2)
     v3 = shapes.Point(2, 2)
     v4 = shapes.Point(-2, 2)
     rec = shapes.Rectangle(v1, v2, v3, v4)
     self.assertFalse(operations.is_inside(circle, rec))
Пример #27
0
 def test_for_point_and_rectangle3(self):
     """the third test for checking if a given point is inside a
     given rectangle with the point being located outside the
     rectangle
     """
     
     point = shapes.Point(5, 5)
     v1 = shapes.Point(-1, -1)
     v2 = shapes.Point(1, -1)
     v3 = shapes.Point(1, 1)
     v4 = shapes.Point(-1, 1)
     rec = shapes.Polygon(v1, v2, v3, v4)
     self.assertFalse(operations.is_inside(point, rec))
Пример #28
0
 def test_for_circle_and_rectangle1(self):
     """the first test for checking if a given circle is located
     inside a given rectangle with the circle being fully inside
     the rectangle
     """
     
     circle = shapes.Circle(shapes.Point(0, 0), 1)
     v1 = shapes.Point(-2, -2)
     v2 = shapes.Point(2, -2)
     v3 = shapes.Point(2, 2)
     v4 = shapes.Point(-2, 2)
     rec = shapes.Rectangle(v1, v2, v3, v4)
     self.assertTrue(operations.is_inside(circle, rec))
Пример #29
0
 def test_for_circle_and_rectangle3(self):
     """the third test for checking if a given circle is located
     inside a given rectangle with the circle intersecting the 
     rectangle
     """
     
     circle = shapes.Circle(shapes.Point(0, -3), 2)
     v1 = shapes.Point(-2, -2)
     v2 = shapes.Point(2, -2)
     v3 = shapes.Point(2, 2)
     v4 = shapes.Point(-2, 2)
     rec = shapes.Rectangle(v1, v2, v3, v4)
     self.assertFalse(operations.is_inside(circle, rec))
Пример #30
0
 def test_for_circle_and_rectangle2(self):
     """the second test for checking if a given circle is located
     inside a given rectangle with the circle being inside the
     rectangle but touching one of its edges
     """
     
     circle = shapes.Circle(shapes.Point(0, -1), 2)
     v1 = shapes.Point(-2, -2)
     v2 = shapes.Point(2, -2)
     v3 = shapes.Point(2, 2)
     v4 = shapes.Point(-2, 2)
     rec = shapes.Rectangle(v1, v2, v3, v4)
     self.assertFalse(operations.is_inside(circle, rec))