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

Method test_decompress_limited

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected