diff --git a/tests/test_spanSets.py b/tests/test_spanSets.py index 79d1915de..cc3f2baad 100644 --- a/tests/test_spanSets.py +++ b/tests/test_spanSets.py @@ -252,6 +252,20 @@ def testIntersection(self): for expected, val in zip(expectedYRange, spanSetIntersectMask): self.assertEqual(expected, val.getY()) + def testIntersectionWithGap(self): + # This test was created in DM-47945 to fix a bug where the + # intersection of two spansets where multiple spans have the same + # y-value would fail. + spans1 = afwGeom.SpanSet([afwGeom.Span(1, 0, 3), afwGeom.Span(1, 5, 7)]) + spans2 = afwGeom.SpanSet([afwGeom.Span(1, 2, 6)]) + intersection = spans1.intersect(spans2) + trueIntersection = afwGeom.SpanSet([afwGeom.Span(1, 2, 3), afwGeom.Span(1, 5, 6)]) + + self.assertEqual(len(intersection), 2) + + for a, b in zip(intersection, trueIntersection): + self.assertEqual(a, b) + def testIntersectNot(self): firstSpanSet, secondSpanSet = self.makeOverlapSpanSets()