Lines Matching refs:zf
1072 with zipfile.ZipFile(io.BytesIO(self.make_zip64_file(**kwargs))) as zf:
1073 zinfo = zf.infolist()[0]
1077 self.assertEqual(zf.read(zinfo), expected_content)
1596 with zipfile.ZipFile(TESTFN, "w") as zf:
1597 zf.writestr("foo.txt", "Test for unicode filename")
1598 zf.writestr("\xf6.txt", "Test for unicode filename")
1599 self.assertIsInstance(zf.infolist()[0].filename, str)
1601 with zipfile.ZipFile(TESTFN, "r") as zf:
1602 self.assertEqual(zf.filelist[0].filename, "foo.txt")
1603 self.assertEqual(zf.filelist[1].filename, "\xf6.txt")
1631 with zipfile.ZipFile(TESTFN, 'a') as zf:
1632 zf.writestr(filename, content)
1638 with zipfile.ZipFile(TESTFN, 'r') as zf:
1639 self.assertEqual(zf.read(filename), content)
1652 zf = zipfile.ZipFile(TESTFN)
2035 with zipfile.ZipFile(zip_file, 'w', compression=zipfile.ZIP_BZIP2) as zf:
2036 zf.writestr('a.txt', b'a')
2038 with zipfile.ZipFile(zip_file) as zf:
2039 self.assertRaises(RuntimeError, zf.extract, 'a.txt')
2710 with zipfile.ZipFile(TESTFN2) as zf:
2711 self.assertEqual(zf.namelist(), namelist)
2712 self.assertEqual(zf.read(namelist[0]), b'test 1')
2713 self.assertEqual(zf.read(namelist[2]), b'test 2')
2723 with zipfile.ZipFile(zip_name) as zf:
2724 for zi in zf.infolist():
2732 self.assertEqual(f.read(), zf.read(zi))
2794 def add_dirs(zf): argument
2799 for name in zipfile.CompleteDirs._implied_dirs(zf.namelist()):
2800 zf.writestr(name, b"")
2801 return zf
2830 zf = zipfile.ZipFile(data, "w")
2831 zf.writestr("a.txt", b"content of a")
2832 zf.writestr("b/c.txt", b"content of c")
2833 zf.writestr("b/d/e.txt", b"content of e")
2834 zf.writestr("b/f.txt", b"content of f")
2835 zf.writestr("g/h/i.txt", b"content of i")
2836 zf.filename = "alpharep.zip"
2837 return zf
2923 zf = zipfile.Path(zipfile.ZipFile(io.BytesIO(), mode='w'))
2924 with zf.joinpath('file.bin').open('wb') as strm:
2926 with zf.joinpath('file.txt').open('w', encoding="utf-8") as strm:
2933 zf = zipfile.Path(add_dirs(build_alpharep_fixture()))
2935 zf.joinpath('b').open()
2949 zf = zipfile.Path(add_dirs(build_alpharep_fixture()))
2951 zf.joinpath('z').open()
3046 zf = zipfile.ZipFile(strm, "w")
3048 zf.writestr(entry, entry)
3049 zf.mode = 'r'
3050 return zf