Skip to content

Commit

Permalink
Add new unit test for SpanSet intersection
Browse files Browse the repository at this point in the history
  • Loading branch information
fred3m committed Dec 4, 2024
1 parent 3280fe6 commit af9ad5d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_spanSets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit af9ad5d

Please sign in to comment.