MCPcopy Index your code
hub / github.com/python/cpython / test_decompress_limited

Method test_decompress_limited

Lib/test/test_zstd.py:2066–2078  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2064 self.assertListEqual(f.readlines(), lines)
2065
2066 def test_decompress_limited(self):
2067 _ZSTD_DStreamInSize = 128*_1K + 3
2068
2069 bomb = compress(b'\0' * int(2e6), level=10)
2070 self.assertLess(len(bomb), _ZSTD_DStreamInSize)
2071
2072 decomp = ZstdFile(io.BytesIO(bomb))
2073 self.assertEqual(decomp.read(1), b'\0')
2074
2075 # BufferedReader uses 128 KiB buffer in __init__.py
2076 max_decomp = 128*_1K
2077 self.assertLessEqual(decomp._buffer.raw.tell(), max_decomp,
2078 "Excessive amount of data was decompressed")
2079
2080 def test_write(self):
2081 raw_data = THIS_FILE_BYTES[: len(THIS_FILE_BYTES) // 6]

Callers

nothing calls this directly

Calls 7

readMethod · 0.95
compressFunction · 0.90
ZstdFileClass · 0.90
assertLessEqualMethod · 0.80
assertLessMethod · 0.45
assertEqualMethod · 0.45
tellMethod · 0.45

Tested by

no test coverage detected