equal
deleted
inserted
replaced
187 dctx = zstd.ZstdDecompressor() |
187 dctx = zstd.ZstdDecompressor() |
188 |
188 |
189 # Will get OverflowError on some Python distributions that can't |
189 # Will get OverflowError on some Python distributions that can't |
190 # handle really large integers. |
190 # handle really large integers. |
191 with self.assertRaises((MemoryError, OverflowError)): |
191 with self.assertRaises((MemoryError, OverflowError)): |
192 dctx.decompress(compressed, max_output_size=2 ** 62) |
192 dctx.decompress(compressed, max_output_size=2**62) |
193 |
193 |
194 def test_dictionary(self): |
194 def test_dictionary(self): |
195 samples = [] |
195 samples = [] |
196 for i in range(128): |
196 for i in range(128): |
197 samples.append(b"foo" * 64) |
197 samples.append(b"foo" * 64) |
236 # If we write a content size, the decompressor engages single pass |
236 # If we write a content size, the decompressor engages single pass |
237 # mode and the window size doesn't come into play. |
237 # mode and the window size doesn't come into play. |
238 cctx = zstd.ZstdCompressor(write_content_size=False) |
238 cctx = zstd.ZstdCompressor(write_content_size=False) |
239 frame = cctx.compress(source) |
239 frame = cctx.compress(source) |
240 |
240 |
241 dctx = zstd.ZstdDecompressor(max_window_size=2 ** zstd.WINDOWLOG_MIN) |
241 dctx = zstd.ZstdDecompressor(max_window_size=2**zstd.WINDOWLOG_MIN) |
242 |
242 |
243 with self.assertRaisesRegex( |
243 with self.assertRaisesRegex( |
244 zstd.ZstdError, |
244 zstd.ZstdError, |
245 "decompression error: Frame requires too much memory", |
245 "decompression error: Frame requires too much memory", |
246 ): |
246 ): |