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

Method test_open_write

Lib/test/test_zipfile/_path/test_path.py:202–211  ·  view source on GitHub ↗

If the zipfile is open for write, it should be possible to write bytes or text to it.

(self)

Source from the content-addressed store, hash-verified

200 assert __file__ == wc.filename
201
202 def test_open_write(self):
203 """
204 If the zipfile is open for write, it should be possible to
205 write bytes or text to it.
206 """
207 zf = zipfile.Path(zipfile.ZipFile(io.BytesIO(), mode='w'))
208 with zf.joinpath('file.bin').open('wb') as strm:
209 strm.write(b'binary contents')
210 with zf.joinpath('file.txt').open('w', encoding="utf-8") as strm:
211 strm.write('text file')
212
213 @pass_alpharep
214 def test_open_extant_directory(self, alpharep):

Callers

nothing calls this directly

Calls 3

joinpathMethod · 0.95
openMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected