def test_isIn_bb(self): """test the isIn function with other bounding box""" bb1 = _BoundingBox(bottom_left=(6, 2), top_right=(12, 6)) self.assertTrue(bb1.contains(_BoundingBox(bottom_left=(6, 2), top_right=(12, 6)))) bb1 = _BoundingBox(bottom_left=(6, 2), top_right=(12, 6)) self.assertTrue(bb1.contains(_BoundingBox(bottom_left=(12, 2), top_right=(12, 2)))) self.assertFalse(_BoundingBox(bottom_left=(12, 2), top_right=(12, 2)).contains(bb1))
def test_collide(self): """test the collide function""" bb1 = _BoundingBox(bottom_left=(6, 2), top_right=(12, 6)) self.assertTrue( bb1.collide(_BoundingBox(bottom_left=(6, 2), top_right=(12, 6)))) bb1 = _BoundingBox(bottom_left=(6, 2), top_right=(12, 6)) self.assertFalse( bb1.collide(_BoundingBox(bottom_left=(12, 2), top_right=(12, 2))))
def test_isIn_pt(self): """test the isIn function with points""" bb = _BoundingBox(bottom_left=(6, 2), top_right=(12, 6)) self.assertTrue(bb.contains((10, 4))) self.assertTrue(bb.contains((6, 2))) self.assertTrue(bb.contains((12, 2))) self.assertFalse(bb.contains((0, 0))) self.assertFalse(bb.contains((20, 0))) self.assertFalse(bb.contains((10, 0)))