def test_misbalanced(self): """Make sure we cleanly excise a tag pair from a pair of interleaved tags.""" # A _________ (2, 6) # B ____________ (5, 9) a = RefWithoutData('a') b = RefWithoutData('b') tags = [(2, True, a), (5, True, b), (6, False, a), (9, False, b)] with catch_warnings(): warnings.simplefilter('ignore') remove_overlapping_refs(tags) eq_(tags, [(2, True, a), (6, False, a)])
def test_overlapping_regions(self): """Regions (as opposed to refs) are allowed to overlap and shouldn't be disturbed:: A _________ (2, 6) B (region) ____________ (5, 9) """ a = RefWithoutData('a') b = Region('b') tags = [(2, True, a), (5, True, b), (6, False, a), (9, False, b)] original_tags = tags[:] remove_overlapping_refs(tags) eq_(tags, original_tags)