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