Пример #1
0
 def test___eq__(self):
     b1 = CollisionBox(Point(1, 1), Point(2, 2))
     b2 = CollisionBox(Point(1, 1), Point(2, 2))
     b3 = CollisionBox(Point(1, 1), Point(2, 3))
     b4 = CollisionBox(Point(0, 1), Point(2, 2))
     b5 = CollisionBox(Point(1, 4), Point(1, 5))
     
     self.assertTrue(b1.__eq__(b2))
     self.assertTrue(not b1.__eq__(b3))
     self.assertTrue(not b1.__eq__(b4))
     self.assertTrue(not b1.__eq__(b5))
Пример #2
0
 def test_collision_box(self):
     """
     Create a new PointShape object and test whether it, indeed, gets
     the CollisionBox expected.
     """
     expected_box = CollisionBox(Point(1, 4), Point(12, 16))
     self.assertTrue(expected_box.__eq__(self.__shape.collision_box))
     
     new_point = Point(15, 3)
     self.__shape.add_point(new_point)
     expected_box = CollisionBox(Point(1,3), Point(15,16))
     self.assertTrue(expected_box.__eq__(self.__shape.collision_box))