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

Method check_big_compress_buffer

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

Source from the content-addressed store, hash-verified

290
291class BaseCompressTestCase(object):
292 def check_big_compress_buffer(self, size, compress_func):
293 _1M = 1024 * 1024
294 # Generate 10 MiB worth of random, and expand it by repeating it.
295 # The assumption is that zlib's memory is not big enough to exploit
296 # such spread out redundancy.
297 data = random.randbytes(_1M * 10)
298 data = data * (size // len(data) + 1)
299 try:
300 compress_func(data)
301 finally:
302 # Release memory
303 data = None
304
305 def check_big_decompress_buffer(self, size, decompress_func):
306 data = b'x' * size

Callers 2

Calls 1

randbytesMethod · 0.45

Tested by

no test coverage detected