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

Method test_extract

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

Source from the content-addressed store, hash-verified

1635 zipfp.writestr(fpath, fdata)
1636
1637 def test_extract(self):
1638 with temp_cwd():
1639 self.make_test_file()
1640 with zipfile.ZipFile(TESTFN2, "r") as zipfp:
1641 for fpath, fdata in SMALL_TEST_DATA:
1642 writtenfile = zipfp.extract(fpath)
1643
1644 # make sure it was written to the right place
1645 correctfile = os.path.join(os.getcwd(), fpath)
1646 correctfile = os.path.normpath(correctfile)
1647
1648 self.assertEqual(writtenfile, correctfile)
1649
1650 # make sure correct data is in correct file
1651 with open(writtenfile, "rb") as f:
1652 self.assertEqual(fdata.encode(), f.read())
1653
1654 unlink(writtenfile)
1655
1656 def _test_extract_with_target(self, target):
1657 self.make_test_file()

Callers

nothing calls this directly

Calls 9

make_test_fileMethod · 0.95
temp_cwdFunction · 0.90
unlinkFunction · 0.90
openFunction · 0.50
extractMethod · 0.45
joinMethod · 0.45
assertEqualMethod · 0.45
encodeMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected