Skip to content

Commit

Permalink
Add test capturing expectation that write works and can be binary or …
Browse files Browse the repository at this point in the history
…text.
  • Loading branch information
jaraco committed Mar 1, 2020
1 parent 19599b7 commit 5a06e14
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test_zipp.py
Expand Up @@ -123,6 +123,17 @@ def test_open(self):
data = strm.read()
assert data == "content of a"

def test_open_write(self):
"""
If the zipfile is open for write, it should be possible to
write bytes or text to it.
"""
zf = zipp.Path(zipfile.ZipFile(io.BytesIO(), mode='w'))
with zf.joinpath('file.bin').open('wb') as strm:
strm.write(b'binary contents')
with zf.joinpath('file.txt').open('w') as strm:
strm.write('text file')

def test_read(self):
for alpharep in self.zipfile_alpharep():
root = zipp.Path(alpharep)
Expand Down

0 comments on commit 5a06e14

Please sign in to comment.