MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_decompress_limited

Method test_decompress_limited

Lib/test/test_gzip.py:718–728  ·  view source on GitHub ↗

Decompressed data buffering should be limited

(self)

Source from the content-addressed store, hash-verified

716 self.assertEqual(f.name, self.filename)
717
718 def test_decompress_limited(self):
719 """Decompressed data buffering should be limited"""
720 bomb = gzip.compress(b'\0' * int(2e6), compresslevel=9)
721 self.assertLess(len(bomb), io.DEFAULT_BUFFER_SIZE)
722
723 bomb = io.BytesIO(bomb)
724 decomp = gzip.GzipFile(fileobj=bomb)
725 self.assertEqual(decomp.read(1), b'\0')
726 max_decomp = 1 + io.DEFAULT_BUFFER_SIZE
727 self.assertLessEqual(decomp._buffer.raw.tell(), max_decomp,
728 "Excessive amount of data was decompressed")
729
730 # Testing compress/decompress shortcut functions
731

Callers

nothing calls this directly

Calls 7

readMethod · 0.95
lenFunction · 0.85
assertLessEqualMethod · 0.80
compressMethod · 0.45
assertLessMethod · 0.45
assertEqualMethod · 0.45
tellMethod · 0.45

Tested by

no test coverage detected