(self, size, compress_func)
| 290 | |
| 291 | class 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 |
no test coverage detected