def testDecompressorChunksMaxsize(self):
    bzd = BZ2Decompressor()
    max_length = 100
    out = []
    len_ = (len(self.BIG_DATA) - 64)
    out.append(bzd.decompress(self.BIG_DATA[:len_], max_length=max_length))
    self.assertFalse(bzd.needs_input)
    self.assertEqual(len(out[(- 1)]), max_length)
    out.append(bzd.decompress(b'', max_length=max_length))
    self.assertFalse(bzd.needs_input)
    self.assertEqual(len(out[(- 1)]), max_length)
    out.append(bzd.decompress(self.BIG_DATA[len_:], max_length=max_length))
    self.assertLessEqual(len(out[(- 1)]), max_length)
    while (not bzd.eof):
        out.append(bzd.decompress(b'', max_length=max_length))
        self.assertLessEqual(len(out[(- 1)]), max_length)
    out = b''.join(out)
    self.assertEqual(out, self.BIG_TEXT)
    self.assertEqual(bzd.unused_data, b'')
def testDecompressorChunksMaxsize(self):
    bzd = BZ2Decompressor()
    max_length = 100
    out = []
    len_ = (len(self.BIG_DATA) - 64)
    out.append(bzd.decompress(self.BIG_DATA[:len_], max_length=max_length))
    self.assertFalse(bzd.needs_input)
    self.assertEqual(len(out[(- 1)]), max_length)
    out.append(bzd.decompress(b, max_length=max_length))
    self.assertFalse(bzd.needs_input)
    self.assertEqual(len(out[(- 1)]), max_length)
    out.append(bzd.decompress(self.BIG_DATA[len_:], max_length=max_length))
    self.assertLessEqual(len(out[(- 1)]), max_length)
    while (not bzd.eof):
        out.append(bzd.decompress(b, max_length=max_length))
        self.assertLessEqual(len(out[(- 1)]), max_length)
    out = b.join(out)
    self.assertEqual(out, self.BIG_TEXT)
    self.assertEqual(bzd.unused_data, b)