MCPcopy Index your code
hub / github.com/python/cpython / test_extract_command

Method test_extract_command

Lib/test/test_zipfile/test_core.py:3508–3523  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3506 unlink(TESTFN2)
3507
3508 def test_extract_command(self):
3509 zip_name = findfile('zipdir.zip', subdir='archivetestdata')
3510 for opt in '-e', '--extract':
3511 with temp_dir() as extdir:
3512 out = self.zipfilecmd(opt, zip_name, extdir)
3513 self.assertEqual(out, b'')
3514 with zipfile.ZipFile(zip_name) as zf:
3515 for zi in zf.infolist():
3516 path = os.path.join(extdir,
3517 zi.filename.replace('/', os.sep))
3518 if zi.is_dir():
3519 self.assertTrue(os.path.isdir(path))
3520 else:
3521 self.assertTrue(os.path.isfile(path))
3522 with open(path, 'rb') as f:
3523 self.assertEqual(f.read(), zf.read(zi))
3524
3525
3526class TestExecutablePrependedZip(unittest.TestCase):

Callers

nothing calls this directly

Calls 13

zipfilecmdMethod · 0.95
findfileFunction · 0.90
temp_dirFunction · 0.90
infolistMethod · 0.80
assertTrueMethod · 0.80
openFunction · 0.50
assertEqualMethod · 0.45
joinMethod · 0.45
replaceMethod · 0.45
is_dirMethod · 0.45
isdirMethod · 0.45
isfileMethod · 0.45

Tested by

no test coverage detected