def test_connecting_spans(self): span_1 = self.span(0, 10) span_2 = self.span(10, 20) resulting_span = self.span(0, 20) self.assertEqual(api._flatten_spans([span_1, span_2]), [resulting_span]) span_1 = self.span(0, 9) span_2 = self.span(10, 20) self.assertEqual(api._flatten_spans([span_1, span_2]), [span_1, span_2])
def test_subsuming_spans(self): span_1 = self.span(0, 30) span_2 = self.span(10, 20) resulting_span = self.span(0, 30) self.assertEqual(api._flatten_spans([span_1, span_2]), [resulting_span]) span_1 = self.span(0, 30) span_2 = self.span(10, 40) resulting_span = self.span(0, 40) self.assertEqual(api._flatten_spans([span_1, span_2]), [resulting_span])
def test_flatten_spans_one_span(self): span = self.span(0, 10) self.assertEqual(api._flatten_spans([span]), [span])
def test_flatten_spans_overlapping_spans(self): span_1 = self.span(0, 10) span_2 = self.span(5, 15) resulting_span = self.span(0, 15) self.assertEqual(api._flatten_spans([span_1, span_2]), [resulting_span])
def test_flatten_spans_no_spans(self): self.assertEqual(api._flatten_spans([]), [])