MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_extract

Method test_extract

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

Source from the content-addressed store, hash-verified

1618 zipfp.writestr(fpath, fdata)
1619
1620 def test_extract(self):
1621 with temp_cwd():
1622 self.make_test_file()
1623 with zipfile.ZipFile(TESTFN2, "r") as zipfp:
1624 for fpath, fdata in SMALL_TEST_DATA:
1625 writtenfile = zipfp.extract(fpath)
1626
1627 # make sure it was written to the right place
1628 correctfile = os.path.join(os.getcwd(), fpath)
1629 correctfile = os.path.normpath(correctfile)
1630
1631 self.assertEqual(writtenfile, correctfile)
1632
1633 # make sure correct data is in correct file
1634 with open(writtenfile, "rb") as f:
1635 self.assertEqual(fdata.encode(), f.read())
1636
1637 unlink(writtenfile)
1638
1639 def _test_extract_with_target(self, target):
1640 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