def test_pad(self): bbox = BoundingBox(0, 100, 0, 100).pad(10) self.assertEquals(bbox, BoundingBox(-10, 110, -10, 110)) bbox = BoundingBox(10, 12, 10, 12) bbox.pad(-0.8) self.assertEquals(bbox, BoundingBox(10.8, 11.2, 10.8, 11.2))
def test_center(self): bbox = BoundingBox(0, 10, 0, 10) self.assertEquals(bbox.center(), (5.0, 5.0)) bbox.pad(500) self.assertEquals(bbox.center(), (5.0, 5.0))