def test_no_overlap(self): hit_a = self.Dummy("A", 50, 100) hit_b = self.Dummy("B", 150, 200) assert remove_overlapping([hit_a, hit_b], self.cutoffs) == [hit_a, hit_b] assert remove_overlapping([hit_b, hit_a], self.cutoffs) == [hit_a, hit_b]
def test_tiebreaker_start(self): a = self.Dummy("a", 50, 150) b = self.Dummy("b", 100, 200) # should take the longest in case of a tie assert remove_overlapping([a, b], self.cutoffs, overlap_limit=10) == [a] assert remove_overlapping([b, a], self.cutoffs, overlap_limit=10) == [a]
def test_single_overlap(self): hit_a = self.Dummy("low", 50, 150) hit_b = self.Dummy("high", 100, 200) assert remove_overlapping([hit_a, hit_b], self.cutoffs, overlap_limit=10) == [hit_b] assert remove_overlapping([hit_b, hit_a], self.cutoffs, overlap_limit=10) == [hit_b]
def test_limit(self): hit_a = self.Dummy("A", 50, 200) hit_b = self.Dummy("B", 150, 200) assert len( remove_overlapping([hit_a, hit_b], self.cutoffs, overlap_limit=100)) == 2 assert len( remove_overlapping([hit_a, hit_b], self.cutoffs, overlap_limit=10)) == 1
def test_tiebreaker_length(self): hit_a = self.Dummy("a", 50, 125) hit_b = self.Dummy("b", 100, 200) # should take the longest in case of hit_a tie assert remove_overlapping([hit_a, hit_b], self.cutoffs, overlap_limit=10) == [hit_b] hit_a = self.Dummy("a", 50, 175) assert remove_overlapping([hit_a, hit_b], self.cutoffs, overlap_limit=10) == [hit_a]
def test_peaks(self): first = self.Dummy("low", 50, 150) mid = self.Dummy("med", 120, 220) last = self.Dummy("low", 200, 300) assert remove_overlapping([first, mid, last], self.cutoffs, overlap_limit=10) == [mid]
def test_multiple_falling(self): high = self.Dummy("high", 50, 150) med = self.Dummy("med", 120, 220) low = self.Dummy("low", 200, 300) assert remove_overlapping([low, med, high], self.cutoffs, overlap_limit=10) == [high, low]