def test_parseIdList(self):
        """
        The function to parse sequence ranges yields appropriate L{MessageSet}
        objects.
        """
        inputs = [
            b'1:*',
            b'5:*',
            b'1:2,5:*',
            b'*',
            b'1',
            b'1,2',
            b'1,3,5',
            b'1:10',
            b'1:10,11',
            b'1:5,10:20',
            b'1,5:10',
            b'1,5:10,15:20',
            b'1:10,15,20:25',
            b'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))

        The function to parse sequence ranges yields appropriate L{MessageSet}
        objects.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/mail/test/test_imap.py