'Adding a sequence of message numbers to a L{MessageSet} that
begins or ends immediately before or after an existing
sequence in that L{MessageSet}, or overlaps one, merges the two.'

def test_rangesMerged(self):

    mergeAfter = MessageSet(1, 3)
    mergeBefore = MessageSet(6, 8)
    mergeBetweenSequence = (mergeAfter + mergeBefore)
    mergeBetweenNumber = (mergeAfter + MessageSet(5, 7))
    self.assertEqual(list((mergeAfter + (2, 4))), [1, 2, 3, 4])
    self.assertEqual(list((mergeAfter + (3, 5))), [1, 2, 3, 4, 5])
    self.assertEqual(list((mergeBefore + (5, 7))), [5, 6, 7, 8])
    self.assertEqual(list((mergeBefore + (4, 6))), [4, 5, 6, 7, 8])
    self.assertEqual(list((mergeBetweenSequence + (3, 5))), [1, 2, 3, 4, 5, 6, 7, 8])
    self.assertEqual(list((mergeBetweenNumber + MessageSet(4))), [1, 2, 3, 4, 5, 6, 7])
