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