(self)
| 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() |
nothing calls this directly
no test coverage detected