mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
Fix bad test code
This commit is contained in:
parent
e76f9a1bc1
commit
93f4c25d39
1 changed files with 7 additions and 8 deletions
|
|
@ -1590,9 +1590,9 @@ def test_remove_zip64(self):
|
||||||
with self.assertRaises(KeyError):
|
with self.assertRaises(KeyError):
|
||||||
zh.getinfo(self.test_files[i][0])
|
zh.getinfo(self.test_files[i][0])
|
||||||
|
|
||||||
# make sure the zip file is still valid
|
# make sure the zip file is still valid
|
||||||
with zipfile.ZipFile(TESTFN) as zh:
|
with zipfile.ZipFile(TESTFN) as zh:
|
||||||
self.assertIsNone(zh.testzip())
|
self.assertIsNone(zh.testzip())
|
||||||
|
|
||||||
def test_remove_closed(self):
|
def test_remove_closed(self):
|
||||||
self._prepare_zip_from_test_files(TESTFN, self.test_files)
|
self._prepare_zip_from_test_files(TESTFN, self.test_files)
|
||||||
|
|
@ -1861,9 +1861,9 @@ def test_repack_bytes_between_files(self):
|
||||||
# check file size
|
# check file size
|
||||||
self.assertEqual(os.path.getsize(TESTFN), expected_size)
|
self.assertEqual(os.path.getsize(TESTFN), expected_size)
|
||||||
|
|
||||||
# make sure the zip file is still valid
|
# make sure the zip file is still valid
|
||||||
with zipfile.ZipFile(TESTFN) as zh:
|
with zipfile.ZipFile(TESTFN) as zh:
|
||||||
self.assertIsNone(zh.testzip())
|
self.assertIsNone(zh.testzip())
|
||||||
|
|
||||||
def test_repack_zip64(self):
|
def test_repack_zip64(self):
|
||||||
"""Should correctly handle file entries with zip64."""
|
"""Should correctly handle file entries with zip64."""
|
||||||
|
|
@ -2158,9 +2158,9 @@ def test_repack_removed_partial(self):
|
||||||
|
|
||||||
def test_repack_removed_bytes_between_files(self):
|
def test_repack_removed_bytes_between_files(self):
|
||||||
"""Should not remove bytes between local file entries."""
|
"""Should not remove bytes between local file entries."""
|
||||||
# calculate the expected results
|
|
||||||
for ii in ([0], [1], [2]):
|
for ii in ([0], [1], [2]):
|
||||||
with self.subTest(removed=ii):
|
with self.subTest(removed=ii):
|
||||||
|
# calculate the expected results
|
||||||
expected_zinfos = []
|
expected_zinfos = []
|
||||||
with open(TESTFN, 'wb') as fh:
|
with open(TESTFN, 'wb') as fh:
|
||||||
with zipfile.ZipFile(fh, 'w', self.compression) as zh:
|
with zipfile.ZipFile(fh, 'w', self.compression) as zh:
|
||||||
|
|
@ -2198,7 +2198,6 @@ def test_repack_removed_bytes_between_files(self):
|
||||||
|
|
||||||
def test_repack_removed_bad_removed_zinfos(self):
|
def test_repack_removed_bad_removed_zinfos(self):
|
||||||
"""Should raise when providing non-removed zinfos."""
|
"""Should raise when providing non-removed zinfos."""
|
||||||
# calculate the expected results
|
|
||||||
for ii in ([0], [1], [2]):
|
for ii in ([0], [1], [2]):
|
||||||
with self.subTest(removed=ii):
|
with self.subTest(removed=ii):
|
||||||
self._prepare_zip_from_test_files(TESTFN, self.test_files)
|
self._prepare_zip_from_test_files(TESTFN, self.test_files)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue