20
20
'requires Decompress.copy()' )
21
21
22
22
23
- # def _zlib_runtime_version_tuple(zlib_version=zlib.ZLIB_RUNTIME_VERSION):
24
- # # Register "1.2.3" as "1.2.3.0"
25
- # # or "1.2.0-linux","1.2.0.f","1.2.0.f-linux"
26
- # v = zlib_version.split('-', 1)[0].split('.')
27
- # if len(v) < 4:
28
- # v.append('0')
29
- # elif not v[-1].isnumeric():
30
- # v[-1] = '0'
31
- # return tuple(map(int, v))
32
- #
33
- #
34
- # ZLIB_RUNTIME_VERSION_TUPLE = _zlib_runtime_version_tuple()
23
+ def _zlib_runtime_version_tuple (zlib_version = zlib .ZLIB_RUNTIME_VERSION ):
24
+ # Register "1.2.3" as "1.2.3.0"
25
+ # or "1.2.0-linux","1.2.0.f","1.2.0.f-linux"
26
+ v = zlib_version .split ('-' , 1 )[0 ].split ('.' )
27
+ if len (v ) < 4 :
28
+ v .append ('0' )
29
+ elif not v [- 1 ].isnumeric ():
30
+ v [- 1 ] = '0'
31
+ return tuple (map (int , v ))
32
+
33
+
34
+ ZLIB_RUNTIME_VERSION_TUPLE = _zlib_runtime_version_tuple ()
35
35
36
36
37
37
# bpo-46623: When a hardware accelerator is used (currently only on s390x),
66
66
67
67
class VersionTestCase (unittest .TestCase ):
68
68
69
- # TODO: RUSTPYTHON
70
- @unittest .expectedFailure
71
69
def test_library_version (self ):
72
70
# Test that the major version of the actual library in use matches the
73
71
# major version that we were compiled against. We can't guarantee that
@@ -282,8 +280,6 @@ def test_64bit_compress(self, size):
282
280
283
281
284
282
class CompressObjectTestCase (BaseCompressTestCase , unittest .TestCase ):
285
- # TODO: RUSTPYTHON
286
- @unittest .expectedFailure
287
283
# Test compression object
288
284
def test_pair (self ):
289
285
# straightforward compress/decompress objects
@@ -307,8 +303,6 @@ def test_pair(self):
307
303
self .assertIsInstance (dco .unconsumed_tail , bytes )
308
304
self .assertIsInstance (dco .unused_data , bytes )
309
305
310
- # TODO: RUSTPYTHON
311
- @unittest .expectedFailure
312
306
def test_keywords (self ):
313
307
level = 2
314
308
method = zlib .DEFLATED
@@ -466,8 +460,6 @@ def test_decompressmaxlen(self, flush=False):
466
460
def test_decompressmaxlenflush (self ):
467
461
self .test_decompressmaxlen (flush = True )
468
462
469
- # TODO: RUSTPYTHON
470
- @unittest .expectedFailure
471
463
def test_maxlenmisc (self ):
472
464
# Misc tests of max_length
473
465
dco = zlib .decompressobj ()
@@ -498,7 +490,7 @@ def test_clear_unconsumed_tail(self):
498
490
ddata += dco .decompress (dco .unconsumed_tail )
499
491
self .assertEqual (dco .unconsumed_tail , b"" )
500
492
501
- # TODO: RUSTPYTHON
493
+ # TODO: RUSTPYTHON: Z_BLOCK support in flate2
502
494
@unittest .expectedFailure
503
495
def test_flushes (self ):
504
496
# Test flush() with the various options, using all the
@@ -560,8 +552,6 @@ def test_empty_flush(self):
560
552
dco = zlib .decompressobj ()
561
553
self .assertEqual (dco .flush (), b"" ) # Returns nothing
562
554
563
- # TODO: RUSTPYTHON
564
- @unittest .expectedFailure
565
555
def test_dictionary (self ):
566
556
h = HAMLET_SCENE
567
557
# Build a simulated dictionary out of the words in HAMLET.
@@ -578,8 +568,6 @@ def test_dictionary(self):
578
568
dco = zlib .decompressobj ()
579
569
self .assertRaises (zlib .error , dco .decompress , cd )
580
570
581
- # TODO: RUSTPYTHON
582
- @unittest .expectedFailure
583
571
def test_dictionary_streaming (self ):
584
572
# This simulates the reuse of a compressor object for compressing
585
573
# several separate data streams.
@@ -652,8 +640,6 @@ def test_decompress_unused_data(self):
652
640
self .assertEqual (dco .unconsumed_tail , b'' )
653
641
self .assertEqual (dco .unused_data , remainder )
654
642
655
- # TODO: RUSTPYTHON
656
- @unittest .expectedFailure
657
643
# issue27164
658
644
def test_decompress_raw_with_dictionary (self ):
659
645
zdict = b'abcdefghijklmnopqrstuvwxyz'
@@ -829,7 +815,7 @@ def test_large_unconsumed_tail(self, size):
829
815
finally :
830
816
comp = uncomp = data = None
831
817
832
- # TODO: RUSTPYTHON
818
+ # TODO: RUSTPYTHON: wbits=0 support in flate2
833
819
@unittest .expectedFailure
834
820
def test_wbits (self ):
835
821
# wbits=0 only supported since zlib v1.2.3.5
@@ -997,8 +983,6 @@ def testDecompressUnusedData(self):
997
983
self .assertEqual (text , self .TEXT )
998
984
self .assertEqual (zlibd .unused_data , unused_data )
999
985
1000
- # TODO: RUSTPYTHON
1001
- @unittest .expectedFailure
1002
986
def testEOFError (self ):
1003
987
zlibd = zlib ._ZlibDecompressor ()
1004
988
text = zlibd .decompress (self .DATA )
@@ -1029,8 +1013,6 @@ def testPickle(self):
1029
1013
with self .assertRaises (TypeError ):
1030
1014
pickle .dumps (zlib ._ZlibDecompressor (), proto )
1031
1015
1032
- # TODO: RUSTPYTHON
1033
- @unittest .expectedFailure
1034
1016
def testDecompressorChunksMaxsize (self ):
1035
1017
zlibd = zlib ._ZlibDecompressor ()
1036
1018
max_length = 100
@@ -1062,8 +1044,6 @@ def testDecompressorChunksMaxsize(self):
1062
1044
self .assertEqual (out , self .BIG_TEXT )
1063
1045
self .assertEqual (zlibd .unused_data , b"" )
1064
1046
1065
- # TODO: RUSTPYTHON
1066
- @unittest .expectedFailure
1067
1047
def test_decompressor_inputbuf_1 (self ):
1068
1048
# Test reusing input buffer after moving existing
1069
1049
# contents to beginning
@@ -1086,8 +1066,6 @@ def test_decompressor_inputbuf_1(self):
1086
1066
out .append (zlibd .decompress (self .DATA [105 :]))
1087
1067
self .assertEqual (b'' .join (out ), self .TEXT )
1088
1068
1089
- # TODO: RUSTPYTHON
1090
- @unittest .expectedFailure
1091
1069
def test_decompressor_inputbuf_2 (self ):
1092
1070
# Test reusing input buffer by appending data at the
1093
1071
# end right away
@@ -1109,8 +1087,6 @@ def test_decompressor_inputbuf_2(self):
1109
1087
out .append (zlibd .decompress (self .DATA [300 :]))
1110
1088
self .assertEqual (b'' .join (out ), self .TEXT )
1111
1089
1112
- # TODO: RUSTPYTHON
1113
- @unittest .expectedFailure
1114
1090
def test_decompressor_inputbuf_3 (self ):
1115
1091
# Test reusing input buffer after extending it
1116
1092
0 commit comments