comparison contrib/python-zstandard/tests/test_decompressor.py @ 51700:7f0cb9ee0534

Backout accidental publication of a large range of revisions I accidentally published 25e7f9dcad0f::bd1483fd7088, this is the inverse.
author Raphaël Gomès <rgomes@octobus.net>
date Tue, 23 Jul 2024 10:02:46 +0200
parents 493034cc3265
children ca7bde5dbafb
comparison
equal deleted inserted replaced
51699:bd1483fd7088 51700:7f0cb9ee0534
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 ):