Skip to content

Commit 0f50a6f

Browse files
committed
Remove unneeded variables
1 parent cb549c9 commit 0f50a6f

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

Lib/test/test_zipfile/test_core.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,13 +1444,13 @@ def test_remove_by_zinfo(self):
14441444
self.assertIsNone(zh.testzip())
14451445

14461446
def test_remove_by_name_nonexist(self):
1447-
zinfos = self._prepare_zip_from_test_files(TESTFN, self.test_files)
1447+
self._prepare_zip_from_test_files(TESTFN, self.test_files)
14481448
with zipfile.ZipFile(TESTFN, 'a', self.compression) as zh:
14491449
with self.assertRaises(KeyError):
14501450
zh.remove('nonexist.txt')
14511451

14521452
def test_remove_by_zinfo_nonexist(self):
1453-
zinfos = self._prepare_zip_from_test_files(TESTFN, self.test_files)
1453+
self._prepare_zip_from_test_files(TESTFN, self.test_files)
14541454
with zipfile.ZipFile(TESTFN, 'a', self.compression) as zh:
14551455
with self.assertRaises(KeyError):
14561456
zh.remove(zipfile.ZipInfo('nonexist.txt'))
@@ -1607,7 +1607,7 @@ def test_remove_closed(self):
16071607
def test_remove_writing(self):
16081608
self._prepare_zip_from_test_files(TESTFN, self.test_files)
16091609
with zipfile.ZipFile(TESTFN, 'a') as zh:
1610-
with zh.open('newfile.txt', 'w') as fh:
1610+
with zh.open('newfile.txt', 'w'):
16111611
with self.assertRaises(ValueError):
16121612
zh.remove(self.test_files[0][0])
16131613

@@ -1704,7 +1704,7 @@ def test_repack_basic(self):
17041704
expected_size = os.path.getsize(TESTFN)
17051705

17061706
# do the removal and check the result
1707-
zinfos = self._prepare_zip_from_test_files(TESTFN, self.test_files)
1707+
self._prepare_zip_from_test_files(TESTFN, self.test_files)
17081708
with zipfile.ZipFile(TESTFN, 'a', self.compression) as zh:
17091709
for i in ii:
17101710
zh.remove(self.test_files[i][0])
@@ -1737,7 +1737,7 @@ def test_repack_bytes_before_first_file(self):
17371737
# do the removal and check the result
17381738
with open(TESTFN, 'wb') as fh:
17391739
fh.write(b'dummy ')
1740-
zinfos = self._prepare_zip_from_test_files(fh, self.test_files)
1740+
self._prepare_zip_from_test_files(fh, self.test_files)
17411741
with zipfile.ZipFile(TESTFN, 'a', self.compression) as zh:
17421742
for i in ii:
17431743
zh.remove(self.test_files[i][0])
@@ -1771,7 +1771,7 @@ def test_repack_magic_before_first_file(self):
17711771
# do the removal and check the result
17721772
with open(TESTFN, 'wb') as fh:
17731773
fh.write(b'PK\003\004 ')
1774-
zinfos = self._prepare_zip_from_test_files(fh, self.test_files)
1774+
self._prepare_zip_from_test_files(fh, self.test_files)
17751775
with zipfile.ZipFile(TESTFN, 'a', self.compression) as zh:
17761776
for i in ii:
17771777
zh.remove(self.test_files[i][0])
@@ -1817,7 +1817,7 @@ def test_repack_file_entry_before_first_file(self):
18171817
zh.writestr('file2.txt', b'dummy')
18181818
zh.writestr('file3.txt', b'dummy')
18191819
fh.write(b' ')
1820-
zinfos = self._prepare_zip_from_test_files(fh, self.test_files)
1820+
self._prepare_zip_from_test_files(fh, self.test_files)
18211821
with zipfile.ZipFile(TESTFN, 'a', self.compression) as zh:
18221822
for i in ii:
18231823
zh.remove(self.test_files[i][0])
@@ -1970,7 +1970,7 @@ def test_repack_zip64(self):
19701970
expected_size = os.path.getsize(TESTFN)
19711971

19721972
# do the removal and check the result
1973-
zinfos = self._prepare_zip_from_test_files(TESTFN, self.test_files, force_zip64=True)
1973+
self._prepare_zip_from_test_files(TESTFN, self.test_files, force_zip64=True)
19741974
with zipfile.ZipFile(TESTFN, 'a', self.compression) as zh:
19751975
for i in ii:
19761976
zh.remove(self.test_files[i][0])
@@ -2001,7 +2001,7 @@ def test_repack_data_descriptor(self):
20012001

20022002
# do the removal and check the result
20032003
with open(TESTFN, 'wb') as fh:
2004-
zinfos = self._prepare_zip_from_test_files(Unseekable(fh), self.test_files)
2004+
self._prepare_zip_from_test_files(Unseekable(fh), self.test_files)
20052005
with zipfile.ZipFile(TESTFN, 'a', self.compression) as zh:
20062006
# make sure data descriptor bit is really set (by making zipfile unseekable)
20072007
for zi in zh.infolist():
@@ -2036,7 +2036,7 @@ def test_repack_data_descriptor_and_zip64(self):
20362036

20372037
# do the removal and check the result
20382038
with open(TESTFN, 'wb') as fh:
2039-
zinfos = self._prepare_zip_from_test_files(Unseekable(fh), self.test_files, force_zip64=True)
2039+
self._prepare_zip_from_test_files(Unseekable(fh), self.test_files, force_zip64=True)
20402040
with zipfile.ZipFile(TESTFN, 'a', self.compression) as zh:
20412041
# make sure data descriptor bit is really set (by making zipfile unseekable)
20422042
for zi in zh.infolist():
@@ -2073,7 +2073,7 @@ def test_repack_data_descriptor_no_sig(self):
20732073
# do the removal and check the result
20742074
with open(TESTFN, 'wb') as fh:
20752075
with mock.patch.object(struct, 'pack', side_effect=struct_pack_no_dd_sig):
2076-
zinfos = self._prepare_zip_from_test_files(Unseekable(fh), self.test_files)
2076+
self._prepare_zip_from_test_files(Unseekable(fh), self.test_files)
20772077
with zipfile.ZipFile(TESTFN, 'a', self.compression) as zh:
20782078
# make sure data descriptor bit is really set (by making zipfile unseekable)
20792079
for zi in zh.infolist():
@@ -2116,7 +2116,7 @@ def test_repack_data_descriptor_no_sig_strict(self):
21162116
# do the removal and check the result
21172117
with open(TESTFN, 'wb') as fh:
21182118
with mock.patch.object(struct, 'pack', side_effect=struct_pack_no_dd_sig):
2119-
zinfos = self._prepare_zip_from_test_files(Unseekable(fh), self.test_files)
2119+
self._prepare_zip_from_test_files(Unseekable(fh), self.test_files)
21202120
with zipfile.ZipFile(TESTFN, 'a', self.compression) as zh:
21212121
# make sure data descriptor bit is really set (by making zipfile unseekable)
21222122
for zi in zh.infolist():
@@ -2157,7 +2157,7 @@ def test_repack_data_descriptor_no_sig_strict_by_decompressoin(self):
21572157
# do the removal and check the result
21582158
with open(TESTFN, 'wb') as fh:
21592159
with mock.patch.object(struct, 'pack', side_effect=struct_pack_no_dd_sig):
2160-
zinfos = self._prepare_zip_from_test_files(Unseekable(fh), self.test_files)
2160+
self._prepare_zip_from_test_files(Unseekable(fh), self.test_files)
21612161
with zipfile.ZipFile(TESTFN, 'a', self.compression) as zh:
21622162
# make sure data descriptor bit is really set (by making zipfile unseekable)
21632163
for zi in zh.infolist():
@@ -2194,7 +2194,7 @@ def test_repack_data_descriptor_no_sig_and_zip64(self):
21942194
# do the removal and check the result
21952195
with open(TESTFN, 'wb') as fh:
21962196
with mock.patch.object(struct, 'pack', side_effect=struct_pack_no_dd_sig):
2197-
zinfos = self._prepare_zip_from_test_files(Unseekable(fh), self.test_files, force_zip64=True)
2197+
self._prepare_zip_from_test_files(Unseekable(fh), self.test_files, force_zip64=True)
21982198
with zipfile.ZipFile(TESTFN, 'a', self.compression) as zh:
21992199
# make sure data descriptor bit is really set (by making zipfile unseekable)
22002200
for zi in zh.infolist():
@@ -2270,7 +2270,7 @@ def test_repack_removed_partial(self):
22702270
with self.subTest(removed=ii):
22712271
# calculate the expected results
22722272
test_files = [data for j, data in enumerate(self.test_files) if j not in ii]
2273-
expected_zinfos = self._prepare_zip_from_test_files(TESTFN, test_files)
2273+
self._prepare_zip_from_test_files(TESTFN, test_files)
22742274
with zipfile.ZipFile(TESTFN, 'a', self.compression) as zh:
22752275
for zi in zh.infolist().copy():
22762276
zh.remove(zi)
@@ -2314,7 +2314,7 @@ def test_repack_removed_bytes_between_files(self):
23142314
# do the removal and check the result
23152315
with open(TESTFN, 'wb') as fh:
23162316
with zipfile.ZipFile(fh, 'w', self.compression) as zh:
2317-
for i, (file, data) in enumerate(self.test_files):
2317+
for file, data in self.test_files:
23182318
zh.writestr(file, data)
23192319
fh.write(b' dummy bytes ')
23202320
zh.start_dir = fh.tell()
@@ -2358,7 +2358,7 @@ def test_repack_closed(self, m_repack):
23582358
def test_repack_writing(self, m_repack):
23592359
self._prepare_zip_from_test_files(TESTFN, self.test_files)
23602360
with zipfile.ZipFile(TESTFN, 'a') as zh:
2361-
with zh.open('newfile.txt', 'w') as fh:
2361+
with zh.open('newfile.txt', 'w'):
23622362
with self.assertRaises(ValueError):
23632363
zh.repack()
23642364
m_repack.assert_not_called()

0 commit comments

Comments
 (0)