Skip to content

Commit

Permalink
Add tests capturing expectation about specific Exceptions when openin…
Browse files Browse the repository at this point in the history
…g directories. Ref #46.
  • Loading branch information
jaraco committed Mar 3, 2020
1 parent 5a06e14 commit bf4a22f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test_zipp.py
Expand Up @@ -134,6 +134,22 @@ def test_open_write(self):
with zf.joinpath('file.txt').open('w') as strm:
strm.write('text file')

def test_open_extant_directory(self):
"""
Attempting to open a directory raises IsADirectoryError.
"""
zf = zipp.Path(add_dirs(build_alpharep_fixture()))
with self.assertRaises(IsADirectoryError):
zf.joinpath('b').open()

def test_open_missing_directory(self):
"""
Attempting to open a missing directory raises FileNotFoundError.
"""
zf = zipp.Path(add_dirs(build_alpharep_fixture()))
with self.assertRaises(FileNotFoundError):
zf.joinpath('z').open()

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

0 comments on commit bf4a22f

Please sign in to comment.