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

Method check_big_compress_buffer

Lib/test/test_zlib.py:184–195  ·  view source on GitHub ↗
(self, size, compress_func)

Source from the content-addressed store, hash-verified

182
183class BaseCompressTestCase(object):
184 def check_big_compress_buffer(self, size, compress_func):
185 _1M = 1024 * 1024
186 # Generate 10 MiB worth of random, and expand it by repeating it.
187 # The assumption is that zlib's memory is not big enough to exploit
188 # such spread out redundancy.
189 data = random.randbytes(_1M * 10)
190 data = data * (size // len(data) + 1)
191 try:
192 compress_func(data)
193 finally:
194 # Release memory
195 data = None
196
197 def check_big_decompress_buffer(self, size, decompress_func):
198 data = b'x' * size

Callers 2

Calls 2

lenFunction · 0.85
randbytesMethod · 0.45

Tested by

no test coverage detected