'The function to parse sequence ranges yields appropriate L{MessageSet}
objects.'

def test_parseIdList(self):

    inputs = ['1:*', '5:*', '1:2,5:*', '*', '1', '1,2', '1,3,5', '1:10', '1:10,11', '1:5,10:20', '1,5:10', '1,5:10,15:20', '1:10,15,20:25', '4:2']
    outputs = [MessageSet(1, None), MessageSet(5, None), (MessageSet(5, None) + MessageSet(1, 2)), MessageSet(None, None), MessageSet(1), MessageSet(1, 2), ((MessageSet(1) + MessageSet(3)) + MessageSet(5)), MessageSet(1, 10), MessageSet(1, 11), (MessageSet(1, 5) + MessageSet(10, 20)), (MessageSet(1) + MessageSet(5, 10)), ((MessageSet(1) + MessageSet(5, 10)) + MessageSet(15, 20)), ((MessageSet(1, 10) + MessageSet(15)) + MessageSet(20, 25)), MessageSet(2, 4)]
    lengths = [None, None, None, 1, 1, 2, 3, 10, 11, 16, 7, 13, 17, 3]
    for (input, expected) in zip(inputs, outputs):
        self.assertEqual(imap4.parseIdList(input), expected)
    for (input, expected) in zip(inputs, lengths):
        if (expected is None):
            self.assertRaises(TypeError, len, imap4.parseIdList(input))
        else:
            L = len(imap4.parseIdList(input))
            self.assertEqual(L, expected, ('len(%r)    =    %r    !=    %r' % (input, L, expected)))
