def test_merge_bounding_box_with_itself(self): box = BoundingBox(Point(30, 45), Point(15, 18)) self.assertEqual(box.merge(box), box)
def test_merge_nested_boxes(self): box_1 = BoundingBox(Point(20, 20), Point(30, 30)) box_2 = BoundingBox(Point(10, 10), Point(40, 40)) self.assertEqual(box_1.merge(box_2), box_2)
def test_merge_with_negative_values(self): box_1 = BoundingBox(Point(10, -30), Point(20, -10)) box_2 = BoundingBox(Point(-20, 10), Point(-10, 20)) expected_merge = BoundingBox(Point(-20, -30), Point(20, 20)) self.assertEqual(box_1.merge(box_2), expected_merge)
def test_merge(self): box_1 = BoundingBox(Point(10, 20), Point(20, 30)) box_2 = BoundingBox(Point(40, -10), Point(50, 0)) expected_merge = BoundingBox(Point(10, -10), Point(50, 30)) self.assertEqual(box_1.merge(box_2), expected_merge)