Skip to content

Commit

Permalink
Add failing unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
TedBrookings committed Dec 3, 2024
1 parent 9c4990e commit 8ebed61
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pybedlite/tests/test_overlap_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,3 +384,18 @@ def test_the_overlap_detector_can_be_built_from_a_bed_file(tmp_path: Path) -> No
detector: OverlapDetector[BedRecord] = OverlapDetector.from_bed(bed)
overlaps: List[BedRecord] = detector.get_overlaps(Interval("chr1", 1, 2))
assert overlaps == [BedRecord(chrom="chr1", start=1, end=2)]


def test_alternating_query_and_adding_intervals() -> None:
detector: OverlapDetector[Interval] = OverlapDetector()

query = Interval("1", 10, 15)
target1 = Interval("1", 10, 100, name="target1")
detector.add(target1)
# Test get_overlaps()
assert detector.get_overlaps(query) == [target1]

target2 = Interval("1", 11, 101, name="target2")
detector.add(target2)
# Test get_overlaps()
assert detector.get_overlaps(query) == [target1, target2]

0 comments on commit 8ebed61

Please sign in to comment.