@@ -1704,17 +1704,13 @@ def test_repack_bytes_before_first_file(self):
17041704 # calculate the expected results
17051705 _test_files = [data for j , data in enumerate (test_files ) if j not in ii ]
17061706 with open (TESTFN , 'wb' ) as fh :
1707- fh .write (b'dummy' )
1708- with open (TESTFN , 'r+b' ) as fh :
1709- fh .seek (0 , 2 )
1707+ fh .write (b'dummy ' )
17101708 expected_zinfos = self ._prepare_zip_from_test_files (fh , _test_files )
17111709 expected_size = os .path .getsize (TESTFN )
17121710
17131711 # do the removal and check the result
17141712 with open (TESTFN , 'wb' ) as fh :
1715- fh .write (b'dummy' )
1716- with open (TESTFN , 'r+b' ) as fh :
1717- fh .seek (0 , 2 )
1713+ fh .write (b'dummy ' )
17181714 zinfos = self ._prepare_zip_from_test_files (fh , test_files )
17191715 with zipfile .ZipFile (TESTFN , 'a' , self .compression ) as zh :
17201716 for i in ii :
@@ -1748,16 +1744,12 @@ def test_repack_magic_before_first_file(self):
17481744 _test_files = [data for j , data in enumerate (test_files ) if j not in ii ]
17491745 with open (TESTFN , 'wb' ) as fh :
17501746 fh .write (b'PK\003 \004 ' )
1751- with open (TESTFN , 'r+b' ) as fh :
1752- fh .seek (0 , 2 )
17531747 expected_zinfos = self ._prepare_zip_from_test_files (fh , _test_files )
17541748 expected_size = os .path .getsize (TESTFN )
17551749
17561750 # do the removal and check the result
17571751 with open (TESTFN , 'wb' ) as fh :
17581752 fh .write (b'PK\003 \004 ' )
1759- with open (TESTFN , 'r+b' ) as fh :
1760- fh .seek (0 , 2 )
17611753 zinfos = self ._prepare_zip_from_test_files (fh , test_files )
17621754 with zipfile .ZipFile (TESTFN , 'a' , self .compression ) as zh :
17631755 for i in ii :
@@ -1777,7 +1769,7 @@ def test_repack_magic_before_first_file(self):
17771769 self .assertEqual (os .path .getsize (TESTFN ), expected_size )
17781770
17791771 def test_repack_file_entry_before_first_file (self ):
1780- """Should preserve seeming valid file entries not forming consecutive
1772+ """Should preserve seemingly valid file entries not forming consecutive
17811773 valid file entries until the first recorded local file entry.
17821774
17831775 This may happen whan a self-extractor contains an uncompressed ZIP
@@ -1797,8 +1789,6 @@ def test_repack_file_entry_before_first_file(self):
17971789 with zipfile .ZipFile (fh , 'w' ) as zh :
17981790 zh .writestr ('file.txt' , b'dummy' )
17991791 fh .write (b' ' )
1800- with open (TESTFN , 'r+b' ) as fh :
1801- fh .seek (0 , 2 )
18021792 expected_zinfos = self ._prepare_zip_from_test_files (fh , _test_files )
18031793 expected_size = os .path .getsize (TESTFN )
18041794
@@ -1807,8 +1797,6 @@ def test_repack_file_entry_before_first_file(self):
18071797 with zipfile .ZipFile (fh , 'w' ) as zh :
18081798 zh .writestr ('file.txt' , b'dummy' )
18091799 fh .write (b' ' )
1810- with open (TESTFN , 'r+b' ) as fh :
1811- fh .seek (0 , 2 )
18121800 zinfos = self ._prepare_zip_from_test_files (fh , test_files )
18131801 with zipfile .ZipFile (TESTFN , 'a' , self .compression ) as zh :
18141802 for i in ii :
0 commit comments