Skip to content

Commit 915078e

Browse files
committed
mark failing tests
1 parent d71223b commit 915078e

File tree

2 files changed

+73
-6
lines changed

2 files changed

+73
-6
lines changed

Lib/test/test_zlib.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
class VersionTestCase(unittest.TestCase):
2121

22+
# TODO: RUSTPYTHON
23+
@unittest.expectedFailure
2224
def test_library_version(self):
2325
# Test that the major version of the actual library in use matches the
2426
# major version that we were compiled against. We can't guarantee that
@@ -29,6 +31,8 @@ def test_library_version(self):
2931

3032

3133
class ChecksumTestCase(unittest.TestCase):
34+
# TODO: RUSTPYTHON
35+
@unittest.expectedFailure
3236
# checksum test cases
3337
def test_crc32start(self):
3438
self.assertEqual(zlib.crc32(b""), zlib.crc32(b"", 0))
@@ -39,6 +43,8 @@ def test_crc32empty(self):
3943
self.assertEqual(zlib.crc32(b"", 1), 1)
4044
self.assertEqual(zlib.crc32(b"", 432), 432)
4145

46+
# TODO: RUSTPYTHON
47+
@unittest.expectedFailure
4248
def test_adler32start(self):
4349
self.assertEqual(zlib.adler32(b""), zlib.adler32(b"", 1))
4450
self.assertTrue(zlib.adler32(b"abc", 0xffffffff))
@@ -102,13 +108,15 @@ def test_badargs(self):
102108
self.assertRaises(TypeError, zlib.compress, arg)
103109
self.assertRaises(TypeError, zlib.decompress, arg)
104110

111+
@unittest.skip('TODO: RUSTPYTHON')
105112
def test_badcompressobj(self):
106113
# verify failure on building compress object with bad params
107114
self.assertRaises(ValueError, zlib.compressobj, 1, zlib.DEFLATED, 0)
108115
# specifying total bits too large causes an error
109116
self.assertRaises(ValueError,
110117
zlib.compressobj, 1, zlib.DEFLATED, zlib.MAX_WBITS + 1)
111118

119+
@unittest.skip('TODO: RUSTPYTHON')
112120
def test_baddecompressobj(self):
113121
# verify failure on building decompress object with bad params
114122
self.assertRaises(ValueError, zlib.decompressobj, -1)
@@ -165,6 +173,8 @@ def test_speech(self):
165173
x = zlib.compress(HAMLET_SCENE)
166174
self.assertEqual(zlib.decompress(x), HAMLET_SCENE)
167175

176+
# TODO: RUSTPYTHON
177+
@unittest.expectedFailure
168178
def test_keywords(self):
169179
x = zlib.compress(HAMLET_SCENE, level=3)
170180
self.assertEqual(zlib.decompress(x), HAMLET_SCENE)
@@ -175,6 +185,8 @@ def test_keywords(self):
175185
bufsize=zlib.DEF_BUF_SIZE),
176186
HAMLET_SCENE)
177187

188+
# TODO: RUSTPYTHON
189+
@unittest.expectedFailure
178190
def test_speech128(self):
179191
# compress more data
180192
data = HAMLET_SCENE * 128
@@ -183,6 +195,8 @@ def test_speech128(self):
183195
for ob in x, bytearray(x):
184196
self.assertEqual(zlib.decompress(ob), data)
185197

198+
# TODO: RUSTPYTHON
199+
@unittest.expectedFailure
186200
def test_incomplete_stream(self):
187201
# A useful error message is given
188202
x = zlib.compress(HAMLET_SCENE)
@@ -201,13 +215,17 @@ def test_big_compress_buffer(self, size):
201215
def test_big_decompress_buffer(self, size):
202216
self.check_big_decompress_buffer(size, zlib.decompress)
203217

218+
# TODO: RUSTPYTHON
219+
@unittest.expectedFailure
204220
@bigmemtest(size=_4G, memuse=1)
205221
def test_large_bufsize(self, size):
206222
# Test decompress(bufsize) parameter greater than the internal limit
207223
data = HAMLET_SCENE * 10
208224
compressed = zlib.compress(data, 1)
209225
self.assertEqual(zlib.decompress(compressed, 15, size), data)
210226

227+
# TODO: RUSTPYTHON
228+
@unittest.expectedFailure
211229
def test_custom_bufsize(self):
212230
data = HAMLET_SCENE * 10
213231
compressed = zlib.compress(data, 1)
@@ -225,6 +243,8 @@ def test_64bit_compress(self, size):
225243

226244

227245
class CompressObjectTestCase(BaseCompressTestCase, unittest.TestCase):
246+
# TODO: RUSTPYTHON
247+
@unittest.expectedFailure
228248
# Test compression object
229249
def test_pair(self):
230250
# straightforward compress/decompress objects
@@ -245,6 +265,8 @@ def test_pair(self):
245265
self.assertIsInstance(dco.unconsumed_tail, bytes)
246266
self.assertIsInstance(dco.unused_data, bytes)
247267

268+
# TODO: RUSTPYTHON
269+
@unittest.expectedFailure
248270
def test_keywords(self):
249271
level = 2
250272
method = zlib.DEFLATED
@@ -266,6 +288,8 @@ def test_keywords(self):
266288
y = do.decompress(x, max_length=len(HAMLET_SCENE)) + do.flush()
267289
self.assertEqual(HAMLET_SCENE, y)
268290

291+
# TODO: RUSTPYTHON
292+
@unittest.expectedFailure
269293
def test_compressoptions(self):
270294
# specify lots of options to compressobj()
271295
level = 2
@@ -281,6 +305,7 @@ def test_compressoptions(self):
281305
y2 = dco.flush()
282306
self.assertEqual(HAMLET_SCENE, y1 + y2)
283307

308+
@unittest.skip('TODO: RUSTPYTHON')
284309
def test_compressincremental(self):
285310
# compress object in steps, decompress object as one-shot
286311
data = HAMLET_SCENE * 128
@@ -296,6 +321,8 @@ def test_compressincremental(self):
296321
y2 = dco.flush()
297322
self.assertEqual(data, y1 + y2)
298323

324+
# TODO: RUSTPYTHON
325+
@unittest.expectedFailure
299326
def test_decompinc(self, flush=False, source=None, cx=256, dcx=64):
300327
# compress object in steps, decompress object in steps
301328
source = source or HAMLET_SCENE
@@ -337,9 +364,13 @@ def test_decompinc(self, flush=False, source=None, cx=256, dcx=64):
337364
self.assertEqual(data, b''.join(bufs))
338365
# Failure means: "decompressobj with init options failed"
339366

367+
# TODO: RUSTPYTHON
368+
@unittest.expectedFailure
340369
def test_decompincflush(self):
341370
self.test_decompinc(flush=True)
342371

372+
# TODO: RUSTPYTHON
373+
@unittest.expectedFailure
343374
def test_decompimax(self, source=None, cx=256, dcx=64):
344375
# compress in steps, decompress in length-restricted steps
345376
source = source or HAMLET_SCENE
@@ -367,6 +398,8 @@ def test_decompimax(self, source=None, cx=256, dcx=64):
367398
bufs.append(dco.flush())
368399
self.assertEqual(data, b''.join(bufs), 'Wrong data retrieved')
369400

401+
# TODO: RUSTPYTHON
402+
@unittest.expectedFailure
370403
def test_decompressmaxlen(self, flush=False):
371404
# Check a decompression object with max_length specified
372405
data = HAMLET_SCENE * 128
@@ -399,15 +432,20 @@ def test_decompressmaxlen(self, flush=False):
399432
bufs.append(chunk)
400433
self.assertEqual(data, b''.join(bufs), 'Wrong data retrieved')
401434

435+
# TODO: RUSTPYTHON
436+
@unittest.expectedFailure
402437
def test_decompressmaxlenflush(self):
403438
self.test_decompressmaxlen(flush=True)
404439

440+
# TODO: RUSTPYTHON
441+
@unittest.expectedFailure
405442
def test_maxlenmisc(self):
406443
# Misc tests of max_length
407444
dco = zlib.decompressobj()
408445
self.assertRaises(ValueError, dco.decompress, b"", -1)
409446
self.assertEqual(b'', dco.unconsumed_tail)
410447

448+
@unittest.skip('TODO: RUSTPYTHON')
411449
def test_maxlen_large(self):
412450
# Sizes up to sys.maxsize should be accepted, although zlib is
413451
# internally limited to expressing sizes with unsigned int
@@ -417,6 +455,8 @@ def test_maxlen_large(self):
417455
dco = zlib.decompressobj()
418456
self.assertEqual(dco.decompress(compressed, sys.maxsize), data)
419457

458+
# TODO: RUSTPYTHON
459+
@unittest.expectedFailure
420460
def test_maxlen_custom(self):
421461
data = HAMLET_SCENE * 10
422462
compressed = zlib.compress(data, 1)
@@ -432,6 +472,8 @@ def test_clear_unconsumed_tail(self):
432472
ddata += dco.decompress(dco.unconsumed_tail)
433473
self.assertEqual(dco.unconsumed_tail, b"")
434474

475+
# TODO: RUSTPYTHON
476+
@unittest.expectedFailure
435477
def test_flushes(self):
436478
# Test flush() with the various options, using all the
437479
# different levels in order to provide more variations.
@@ -498,6 +540,7 @@ def test_odd_flush(self):
498540
# if decompressed data is different from the input data, choke.
499541
self.assertEqual(expanded, data, "17K random source doesn't match")
500542

543+
@unittest.skip('TODO: RUSTPYTHON')
501544
def test_empty_flush(self):
502545
# Test that calling .flush() on unused objects works.
503546
# (Bug #1083110 -- calling .flush() on decompress objects
@@ -508,6 +551,8 @@ def test_empty_flush(self):
508551
dco = zlib.decompressobj()
509552
self.assertEqual(dco.flush(), b"") # Returns nothing
510553

554+
# TODO: RUSTPYTHON
555+
@unittest.expectedFailure
511556
def test_dictionary(self):
512557
h = HAMLET_SCENE
513558
# Build a simulated dictionary out of the words in HAMLET.
@@ -524,6 +569,8 @@ def test_dictionary(self):
524569
dco = zlib.decompressobj()
525570
self.assertRaises(zlib.error, dco.decompress, cd)
526571

572+
# TODO: RUSTPYTHON
573+
@unittest.expectedFailure
527574
def test_dictionary_streaming(self):
528575
# This simulates the reuse of a compressor object for compressing
529576
# several separate data streams.
@@ -537,6 +584,8 @@ def test_dictionary_streaming(self):
537584
self.assertEqual(do.decompress(d1), piece[100:])
538585
self.assertEqual(do.decompress(d2), piece[:-100])
539586

587+
# TODO: RUSTPYTHON
588+
@unittest.expectedFailure
540589
def test_decompress_incomplete_stream(self):
541590
# This is 'foo', deflated
542591
x = b'x\x9cK\xcb\xcf\x07\x00\x02\x82\x01E'
@@ -550,6 +599,8 @@ def test_decompress_incomplete_stream(self):
550599
y += dco.flush()
551600
self.assertEqual(y, b'foo')
552601

602+
# TODO: RUSTPYTHON
603+
@unittest.expectedFailure
553604
def test_decompress_eof(self):
554605
x = b'x\x9cK\xcb\xcf\x07\x00\x02\x82\x01E' # 'foo'
555606
dco = zlib.decompressobj()
@@ -561,6 +612,7 @@ def test_decompress_eof(self):
561612
dco.flush()
562613
self.assertTrue(dco.eof)
563614

615+
@unittest.skip('TODO: RUSTPYTHON')
564616
def test_decompress_eof_incomplete_stream(self):
565617
x = b'x\x9cK\xcb\xcf\x07\x00\x02\x82\x01E' # 'foo'
566618
dco = zlib.decompressobj()
@@ -570,6 +622,8 @@ def test_decompress_eof_incomplete_stream(self):
570622
dco.flush()
571623
self.assertFalse(dco.eof)
572624

625+
# TODO: RUSTPYTHON
626+
@unittest.expectedFailure
573627
def test_decompress_unused_data(self):
574628
# Repeated calls to decompress() after EOF should accumulate data in
575629
# dco.unused_data, instead of just storing the arg to the last call.
@@ -596,6 +650,8 @@ def test_decompress_unused_data(self):
596650
self.assertEqual(dco.unconsumed_tail, b'')
597651
self.assertEqual(dco.unused_data, remainder)
598652

653+
# TODO: RUSTPYTHON
654+
@unittest.expectedFailure
599655
# issue27164
600656
def test_decompress_raw_with_dictionary(self):
601657
zdict = b'abcdefghijklmnopqrstuvwxyz'
@@ -605,6 +661,7 @@ def test_decompress_raw_with_dictionary(self):
605661
uncomp = dco.decompress(comp) + dco.flush()
606662
self.assertEqual(zdict, uncomp)
607663

664+
@unittest.skip('TODO: RUSTPYTHON')
608665
def test_flush_with_freed_input(self):
609666
# Issue #16411: decompressor accesses input to last decompress() call
610667
# in flush(), even if this object has been freed in the meanwhile.
@@ -617,6 +674,7 @@ def test_flush_with_freed_input(self):
617674
data = zlib.compress(input2)
618675
self.assertEqual(dco.flush(), input1[1:])
619676

677+
@unittest.skip('TODO: RUSTPYTHON')
620678
@bigmemtest(size=_4G, memuse=1)
621679
def test_flush_large_length(self, size):
622680
# Test flush(length) parameter greater than internal limit UINT_MAX
@@ -626,6 +684,7 @@ def test_flush_large_length(self, size):
626684
dco.decompress(data, 1)
627685
self.assertEqual(dco.flush(size), input[1:])
628686

687+
@unittest.skip('TODO: RUSTPYTHON')
629688
def test_flush_custom_length(self):
630689
input = HAMLET_SCENE * 10
631690
data = zlib.compress(input, 1)
@@ -715,18 +774,21 @@ def test_decompresspickle(self):
715774

716775
# Memory use of the following functions takes into account overallocation
717776

777+
@unittest.skip('TODO: RUSTPYTHON')
718778
@bigmemtest(size=_1G + 1024 * 1024, memuse=3)
719779
def test_big_compress_buffer(self, size):
720780
c = zlib.compressobj(1)
721781
compress = lambda s: c.compress(s) + c.flush()
722782
self.check_big_compress_buffer(size, compress)
723783

784+
@unittest.skip('TODO: RUSTPYTHON')
724785
@bigmemtest(size=_1G + 1024 * 1024, memuse=2)
725786
def test_big_decompress_buffer(self, size):
726787
d = zlib.decompressobj()
727788
decompress = lambda s: d.decompress(s) + d.flush()
728789
self.check_big_decompress_buffer(size, decompress)
729790

791+
@unittest.skip('TODO: RUSTPYTHON')
730792
@unittest.skipUnless(sys.maxsize > 2**32, 'requires 64bit platform')
731793
@bigmemtest(size=_4G + 100, memuse=4)
732794
def test_64bit_compress(self, size):
@@ -740,6 +802,7 @@ def test_64bit_compress(self, size):
740802
finally:
741803
comp = uncomp = data = None
742804

805+
@unittest.skip('TODO: RUSTPYTHON')
743806
@unittest.skipUnless(sys.maxsize > 2**32, 'requires 64bit platform')
744807
@bigmemtest(size=_4G + 100, memuse=3)
745808
def test_large_unused_data(self, size):
@@ -754,6 +817,7 @@ def test_large_unused_data(self, size):
754817
finally:
755818
unused = comp = do = None
756819

820+
@unittest.skip('TODO: RUSTPYTHON')
757821
@unittest.skipUnless(sys.maxsize > 2**32, 'requires 64bit platform')
758822
@bigmemtest(size=_4G + 100, memuse=5)
759823
def test_large_unconsumed_tail(self, size):
@@ -767,6 +831,8 @@ def test_large_unconsumed_tail(self, size):
767831
finally:
768832
comp = uncomp = data = None
769833

834+
# TODO: RUSTPYTHON
835+
@unittest.expectedFailure
770836
def test_wbits(self):
771837
# wbits=0 only supported since zlib v1.2.3.5
772838
# Register "1.2.3" as "1.2.3.0"

vm/src/stdlib/zlib.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -397,12 +397,13 @@ impl PyCompress {
397397
self.inner.lock().flush(vm)
398398
}
399399

400-
#[pymethod]
401-
#[pymethod(magic)]
402-
#[pymethod(name = "__deepcopy__")]
403-
fn copy(&self) -> Self {
404-
todo!("<flate2::Compress as Clone>")
405-
}
400+
// TODO: This is optional feature of Compress
401+
// #[pymethod]
402+
// #[pymethod(magic)]
403+
// #[pymethod(name = "__deepcopy__")]
404+
// fn copy(&self) -> Self {
405+
// todo!("<flate2::Compress as Clone>")
406+
// }
406407
}
407408

408409
const CHUNKSIZE: usize = libc::c_uint::MAX as usize;

0 commit comments

Comments
 (0)