def testDecompressLimited(self):
    'Decompressed data buffering should be limited'
    bomb = bz2.compress((b'\x00' * int(2000000.0)), compresslevel=9)
    self.assertLess(len(bomb), _compression.BUFFER_SIZE)
    decomp = BZ2File(BytesIO(bomb))
    self.assertEqual(decomp.read(1), b'\x00')
    max_decomp = (1 + DEFAULT_BUFFER_SIZE)
    self.assertLessEqual(decomp._buffer.raw.tell(), max_decomp, 'Excessive amount of data was decompressed')
Decompressed data buffering should be limited
def testDecompressLimited(self):
    
    bomb = bz2.compress((b'\x00' * int(2000000.0)), compresslevel=9)
    self.assertLess(len(bomb), _compression.BUFFER_SIZE)
    decomp = BZ2File(BytesIO(bomb))
    self.assertEqual(decomp.read(1), b'\x00')
    max_decomp = (1 + DEFAULT_BUFFER_SIZE)
    self.assertLessEqual(decomp._buffer.raw.tell(), max_decomp, 'Excessive amount of data was decompressed')