def test_with_several_elements2(self): starts = [ 7, 13, 0, 0, 1, 6, -3, -3, -3, 0 ] ends = [ 6, 4, 8, 3, 2, 4, 9, 15, 9, 8 ] sort_segments(starts, ends) self.assertEqual([ -3, -3, -3, 0, 0, 0, 1, 6, 7, 13 ], starts) self.assertEqual([ 9, 9, 15, 3, 8, 8, 2, 4, 6, 4 ], ends)
def test_with_duplicate_starts_and_ends(self): starts = [ 6, 6, 6, 6, 6 ] ends = [ 5, 5, 5, 5, 5 ] sort_segments(starts, ends) self.assertEqual([ 6, 6, 6, 6, 6 ], starts) self.assertEqual([ 5, 5, 5, 5, 5 ], ends)
def test_with_duplicate_ends(self): starts = [ 5, 4, 3, 2, 1 ] ends = [ 5, 5, 5, 5, 5 ] sort_segments(starts, ends) self.assertEqual([ 1, 2, 3, 4, 5 ], starts) self.assertEqual([ 5, 5, 5, 5, 5 ], ends)
def test_with_duplicate_starts(self): starts = [ 5, 5, 5, 5, 5 ] ends = [ 3, 6, 2, 1, 7 ] sort_segments(starts, ends) self.assertEqual([ 5, 5, 5, 5, 5 ], starts) self.assertEqual([ 1, 2, 3, 6, 7 ], ends)
def test_with_empty_data(self): starts = [] ends = [] sort_segments(starts, ends) self.assertEqual([], starts) self.assertEqual([], ends)
def test_with_starts_smaller_than_ends(self): starts = [ 1 ] ends = [ 1, 2, 3 ] with self.assertRaisesRegex(AssertionError, ''): sort_segments(starts, ends)