Example #1
0
 def test_intersect(self):
     """Testing all methods, that check intersection"""
     sec1 = g.Sector(g.Point(0, 0), g.Point(0, 10))
     sec2 = g.Sector(g.Point(0, 0), g.Point(10, 0))
     sec3 = g.Sector(g.Point(-5, 5), g.Point(5, 5))
     self.assertTrue(sec1.is_intersect(sec3))
     self.assertTrue(g.Sector.sec_is_intersect(sec1, sec3))
     self.assertFalse(sec1.is_intersect(sec2))
     self.assertFalse(g.Sector.sec_is_intersect(sec1, sec2))
Example #2
0
 def test_cointains(self):
     """Testing all methods, that check contains Point in Sector"""
     sec = g.Sector(g.Point(1, 1), g.Point(10, 10))
     self.assertTrue(sec.in_sector(g.Point(5, 5)))
     self.assertTrue(sec.point_is_end(g.Point(1, 1)))
     self.assertTrue(sec.in_with_end(g.Point(1, 1)))
     self.assertFalse(sec.in_sector(g.Point(0, 0)))
Example #3
0
 def test_match(self):
     """Testing all methods, that check matching"""
     sec1 = g.Sector(g.Point(0, 0), g.Point(0, 10))
     sec2 = g.Sector(g.Point(0, 5), g.Point(0, 15))
     self.assertTrue(sec1.is_match(sec2))
     self.assertTrue(g.Sector.sec_is_match(sec1, sec2))
Example #4
0
 def test_coo_equation(self):
     """Test coo_for_equation()"""
     sec = g.Sector(g.Point(0, 0), g.Point(0, 10))
     coof = sec.coo_for_equation()
     self.assertEqual(coof[0], -10)
     self.assertTrue(coof[1] == coof[2] == 0)
Example #5
0
 def test_special_methods(self):
     """Test special methods: __len__, __eq__"""
     sec = g.Sector(g.Point(1, 1), g.Point(1, 5))
     self.assertEqual(sec.length(), 4)
     self.assertEqual(sec, g.Sector(g.Point(1, 1), g.Point(1, 5)))