@@ -200,16 +200,16 @@ def test_simple_compress_bad_args(self):
200200        self .assertRaises (TypeError , ZstdCompressor , zstd_dict = {1 : 2 , 3 : 4 })
201201
202202        # valid range for compression level is [-(1<<17), 22] 
203-         msg  =  'compression level {} not in  valid range -131072 <= level <= 22 ' 
203+         msg  =  'illegal  compression level {}; the  valid range is [ -131072, 22] ' 
204204        with  self .assertRaisesRegex (ValueError , msg .format (C_INT_MAX )):
205205            ZstdCompressor (C_INT_MAX )
206206        with  self .assertRaisesRegex (ValueError , msg .format (C_INT_MIN )):
207207            ZstdCompressor (C_INT_MIN )
208-         msg  =  'compression level not in  valid range -131072 <= level <= 22 ' 
208+         msg  =  'illegal  compression level; the  valid range is [ -131072, 22] ' 
209209        with  self .assertRaisesRegex (ValueError , msg ):
210210            ZstdCompressor (level = - (2 ** 1000 ))
211211        with  self .assertRaisesRegex (ValueError , msg ):
212-             ZstdCompressor (level = ( 2 ** 1000 ) )
212+             ZstdCompressor (level = 2 ** 1000 )
213213
214214        with  self .assertRaises (ValueError ):
215215            ZstdCompressor (options = {CompressionParameter .window_log : 100 })
@@ -305,7 +305,7 @@ def test_compress_parameters(self):
305305        with  self .assertRaisesRegex (
306306            ValueError ,
307307            "compression parameter 'window_log' received an illegal value 100; " 
308-             r'the valid range is \d+ <= value <=  \d+' ,
308+             r'the valid range is \[\d+,  \d+\] ' ,
309309        ):
310310            compress (b'' , options = option )
311311
@@ -439,10 +439,17 @@ def test_decompress_parameters(self):
439439
440440        d1  =  d .copy ()
441441        # larger than signed int 
442+         d1 [DecompressionParameter .window_log_max ] =  2 ** 1000 
443+         with  self .assertRaises (OverflowError ):
444+             ZstdDecompressor (None , d1 )
445+         # smaller than signed int 
446+         d1 [DecompressionParameter .window_log_max ] =  - (2 ** 1000 )
447+         with  self .assertRaises (OverflowError ):
448+             ZstdDecompressor (None , d1 )
449+ 
442450        d1 [DecompressionParameter .window_log_max ] =  C_INT_MAX 
443451        with  self .assertRaises (ValueError ):
444452            ZstdDecompressor (None , d1 )
445-         # smaller than signed int 
446453        d1 [DecompressionParameter .window_log_max ] =  C_INT_MIN 
447454        with  self .assertRaises (ValueError ):
448455            ZstdDecompressor (None , d1 )
@@ -452,7 +459,7 @@ def test_decompress_parameters(self):
452459        with  self .assertRaisesRegex (
453460            ValueError ,
454461            "decompression parameter 'window_log_max' received an illegal value 100; " 
455-             r'the valid range is \d+ <= value <=  \d+' ,
462+             r'the valid range is \[\d+,  \d+\] ' ,
456463        ):
457464            decompress (b'' , options = options )
458465
0 commit comments