def test_swapped_order_empty(self): """Test what 'shouldn't happen'.""" with self.assertRaises(AssertionError): list( substitution.labeled_spans( substitution.Substitution(matched_spans={'a': (10, 5)}, primary_label='a')))
def test_empty_range(self): self.assertEqual( list( substitution.labeled_spans( substitution.Substitution(matched_spans={'a': (0, 0)}, primary_label='a'))), [substitution.LabeledSpan(labels={'a'}, span=(0, 0))])
def test_total_overlap(self): self.assertEqual( list( substitution.labeled_spans( substitution.Substitution(matched_spans={ 'a': (0, 10), 'b': (0, 10) }, primary_label='a'))), [substitution.LabeledSpan(labels={'a', 'b'}, span=(0, 10))])
def test_gap(self): self.assertEqual( list( substitution.labeled_spans( substitution.Substitution(matched_spans={ 'a': (0, 10), 'b': (20, 30) }, primary_label='a'))), [ substitution.LabeledSpan(labels={'a'}, span=(0, 10)), substitution.LabeledSpan(labels=set(), span=(10, 20)), substitution.LabeledSpan(labels={'b'}, span=(20, 30)) ])