Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Feb 10, 2018
1 parent 804536b commit 8c3b751
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 2 additions & 3 deletions fs/tarfs.py
Expand Up @@ -87,11 +87,10 @@ def __new__(cls,
temp_fs="temp://__tartemp__"):

if isinstance(file, (six.text_type, six.binary_type)):
file = os.path.expanduser(file)
filename = file
else:
filename = getattr(file, 'name', '')
if not hasattr(file, 'read'):
file = os.path.expanduser(file)

if write and compression is None:
compression = None
Expand Down Expand Up @@ -299,7 +298,7 @@ def listdir(self, path):
if _path:
if info is None:
raise errors.ResourceNotFound(path)
if not info.isdir:
if not info.isdir():
raise errors.DirectoryExpected(path)
dir_list = [
basename(name)
Expand Down
4 changes: 4 additions & 0 deletions tests/test_archives.py
Expand Up @@ -147,3 +147,7 @@ def test_implied_dir(self):
def test_listdir(self):
for name in self.fs.listdir('/'):
self.assertIsInstance(name, text_type)
with self.assertRaises(errors.ResourceNotFound):
self.fs.listdir('nope')
with self.assertRaises(errors.DirectoryExpected):
self.fs.listdir('top.txt')

0 comments on commit 8c3b751

Please sign in to comment.