@@ -2451,16 +2451,14 @@ def test_iter_scan_signature(self):
24512451 [0 , 5 , 10 , 15 ],
24522452 )
24532453
2454- @requires_zlib ()
24552454 def test_scan_data_descriptor (self ):
2456- import zlib
24572455 repacker = zipfile ._ZipRepacker ()
24582456
24592457 # basic
24602458 bytes_ = b'dummyPK\x07 \x08 \x3f \xf2 \xf4 \x4f \x05 \x00 \x00 \x00 \x05 \x00 \x00 \x00 '
24612459 self .assertEqual (
24622460 repacker ._scan_data_descriptor (io .BytesIO (bytes_ ), 0 , len (bytes_ ), False ),
2463- (zlib . crc32 ( b'dummy' ) , 5 , 5 , 16 ),
2461+ (0x4ff4f23f , 5 , 5 , 16 ),
24642462 )
24652463
24662464 # return None if no signature
@@ -2488,7 +2486,7 @@ def test_scan_data_descriptor(self):
24882486 bytes_ = b'dummyPK\x07 \x08 \x3f \xf2 \xf4 \x4f \x05 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x05 \x00 \x00 \x00 \x00 \x00 \x00 \x00 '
24892487 self .assertEqual (
24902488 repacker ._scan_data_descriptor (io .BytesIO (bytes_ ), 0 , len (bytes_ ), True ),
2491- (zlib . crc32 ( b'dummy' ) , 5 , 5 , 24 ),
2489+ (0x4ff4f23f , 5 , 5 , 24 ),
24922490 )
24932491
24942492 # offset
@@ -2505,7 +2503,7 @@ def test_scan_data_descriptor(self):
25052503 )
25062504 self .assertEqual (
25072505 repacker ._scan_data_descriptor (io .BytesIO (bytes_ ), 3 , len (bytes_ ), False ),
2508- (zlib . crc32 ( b'dummy' ) , 5 , 5 , 16 ),
2506+ (0x4ff4f23f , 5 , 5 , 16 ),
25092507 )
25102508
25112509 # end_offset
@@ -2518,19 +2516,17 @@ def test_scan_data_descriptor(self):
25182516 bytes_ = b'dummyPK\x07 \x08 \x3f \xf2 \xf4 \x4f \x05 \x00 \x00 \x00 \x05 \x00 \x00 \x00 123'
25192517 self .assertEqual (
25202518 repacker ._scan_data_descriptor (io .BytesIO (bytes_ ), 0 , len (bytes_ ) - 3 , False ),
2521- (zlib . crc32 ( b'dummy' ) , 5 , 5 , 16 ),
2519+ (0x4ff4f23f , 5 , 5 , 16 ),
25222520 )
25232521
2524- @requires_zlib ()
25252522 def test_scan_data_descriptor_no_sig (self ):
2526- import zlib
25272523 repacker = zipfile ._ZipRepacker ()
25282524
25292525 # basic
25302526 bytes_ = b'dummy\x3f \xf2 \xf4 \x4f \x05 \x00 \x00 \x00 \x05 \x00 \x00 \x00 '
25312527 self .assertEqual (
25322528 repacker ._scan_data_descriptor_no_sig (io .BytesIO (bytes_ ), 0 , len (bytes_ ), False ),
2533- (zlib . crc32 ( b'dummy' ) , 5 , 5 , 12 ),
2529+ (0x4ff4f23f , 5 , 5 , 12 ),
25342530 )
25352531
25362532 # return None if compressed size not match
@@ -2544,7 +2540,7 @@ def test_scan_data_descriptor_no_sig(self):
25442540 bytes_ = b'dummy\x3f \xf2 \xf4 \x4f \x05 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x05 \x00 \x00 \x00 \x00 \x00 \x00 \x00 '
25452541 self .assertEqual (
25462542 repacker ._scan_data_descriptor_no_sig (io .BytesIO (bytes_ ), 0 , len (bytes_ ), True ),
2547- (zlib . crc32 ( b'dummy' ) , 5 , 5 , 20 ),
2543+ (0x4ff4f23f , 5 , 5 , 20 ),
25482544 )
25492545
25502546 # offset
@@ -2561,7 +2557,7 @@ def test_scan_data_descriptor_no_sig(self):
25612557 )
25622558 self .assertEqual (
25632559 repacker ._scan_data_descriptor_no_sig (io .BytesIO (bytes_ ), 3 , len (bytes_ ), False ),
2564- (zlib . crc32 ( b'dummy' ) , 5 , 5 , 12 ),
2560+ (0x4ff4f23f , 5 , 5 , 12 ),
25652561 )
25662562
25672563 # end_offset
@@ -2574,18 +2570,18 @@ def test_scan_data_descriptor_no_sig(self):
25742570 bytes_ = b'dummy\x3f \xf2 \xf4 \x4f \x05 \x00 \x00 \x00 \x05 \x00 \x00 \x00 123'
25752571 self .assertEqual (
25762572 repacker ._scan_data_descriptor_no_sig (io .BytesIO (bytes_ ), 0 , len (bytes_ ) - 3 , False ),
2577- (zlib . crc32 ( b'dummy' ) , 5 , 5 , 12 ),
2573+ (0x4ff4f23f , 5 , 5 , 12 ),
25782574 )
25792575
25802576 # chunk_size
25812577 bytes_ = b'dummy\x3f \xf2 \xf4 \x4f \x05 \x00 \x00 \x00 \x05 \x00 \x00 \x00 '
25822578 self .assertEqual (
25832579 repacker ._scan_data_descriptor_no_sig (io .BytesIO (bytes_ ), 0 , len (bytes_ ), False , 12 ),
2584- (zlib . crc32 ( b'dummy' ) , 5 , 5 , 12 ),
2580+ (0x4ff4f23f , 5 , 5 , 12 ),
25852581 )
25862582 self .assertEqual (
25872583 repacker ._scan_data_descriptor_no_sig (io .BytesIO (bytes_ ), 0 , len (bytes_ ), False , 1 ),
2588- (zlib . crc32 ( b'dummy' ) , 5 , 5 , 12 ),
2584+ (0x4ff4f23f , 5 , 5 , 12 ),
25892585 )
25902586
25912587 @requires_zlib ()
@@ -2611,7 +2607,7 @@ def test_scan_data_descriptor_no_sig_by_decompression(self):
26112607 self .assertEqual (
26122608 repacker ._scan_data_descriptor_no_sig_by_decompression (
26132609 io .BytesIO (bytes_ ), 0 , len (bytes_ ), False , method ),
2614- (zlib . crc32 ( b'dummy' ) , comp_len , 5 , 12 ),
2610+ (0x4ff4f23f , comp_len , 5 , 12 ),
26152611 )
26162612
26172613 # return None if insufficient data length
@@ -2642,7 +2638,7 @@ def test_scan_data_descriptor_no_sig_by_decompression(self):
26422638 self .assertEqual (
26432639 repacker ._scan_data_descriptor_no_sig_by_decompression (
26442640 io .BytesIO (bytes_ ), 0 , len (bytes_ ), True , method ),
2645- (zlib . crc32 ( b'dummy' ) , comp_len , 5 , 20 ),
2641+ (0x4ff4f23f , comp_len , 5 , 20 ),
26462642 )
26472643
26482644 # offset
@@ -2657,7 +2653,7 @@ def test_scan_data_descriptor_no_sig_by_decompression(self):
26572653 self .assertEqual (
26582654 repacker ._scan_data_descriptor_no_sig_by_decompression (
26592655 io .BytesIO (bytes_ ), 3 , len (bytes_ ), False , method ),
2660- (zlib . crc32 ( b'dummy' ) , comp_len , 5 , 12 ),
2656+ (0x4ff4f23f , comp_len , 5 , 12 ),
26612657 )
26622658
26632659 # end_offset
@@ -2672,7 +2668,7 @@ def test_scan_data_descriptor_no_sig_by_decompression(self):
26722668 self .assertEqual (
26732669 repacker ._scan_data_descriptor_no_sig_by_decompression (
26742670 io .BytesIO (bytes_ ), 0 , len (bytes_ ) - 2 , False , method ),
2675- (zlib . crc32 ( b'dummy' ) , comp_len , 5 , 12 ),
2671+ (0x4ff4f23f , comp_len , 5 , 12 ),
26762672 )
26772673
26782674 def test_scan_data_descriptor_no_sig_by_decompression_invalid (self ):
0 commit comments