def test_wikipedia_entry(self):
        decoded = StringIO()
        encoded = StringIO()

        input = """25\r\nThis is the data in the first chunk\r\n\r\n1C\r\nand this is the second one\r\n\r\n3\r\ncon\r\n8\r\nsequence\r\n0\r\n\r\n"""
        output = """This is the data in the first chunk\r\nand this is the second one\r\nconsequence"""

        for chunk in chunks.decode(StringIO(input)):
            decoded.write(chunk)

        decoded.seek(0)

        for chunk in chunks.encode(decoded):
            encoded.write(chunk)

        decoded = StringIO()
        encoded.seek(0)

        for chunk in chunks.decode(StringIO(input)):
            decoded.write(chunk)

        self.assertEqual(output, decoded.getvalue())
    def test_encode(self):
        fileobj = StringIO(testdata_in)

        for found, expected in zip(chunks.encode(fileobj, chunk_limit=4), testdata_out):
            self.assertEqual(found, expected)