Skip to content

Commit ab0ab0c

Browse files
authored
Merge pull request #445 from eelkevdbos/doc-update
Update FS.upload docstring to reflect exceptions thrown
2 parents 9bd26ac + 6b30f6a commit ab0ab0c

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

fs/base.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,6 +1309,10 @@ def upload(self, path, file, chunk_size=None, **options):
13091309
**options: Implementation specific options required to open
13101310
the source file.
13111311
1312+
Raises:
1313+
fs.errors.ResourceNotFound: If a parent directory of
1314+
``path`` does not exist.
1315+
13121316
Note that the file object ``file`` will *not* be closed by this
13131317
method. Take care to close it after this method completes
13141318
(ideally with a context manager).

fs/test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,6 +1494,10 @@ def test_upload(self):
14941494
with self.fs.open("foo", "rb") as f:
14951495
data = f.read()
14961496
self.assertEqual(data, b"bar")
1497+
1498+
# upload to non-existing path (/spam/eggs)
1499+
with self.assertRaises(errors.ResourceNotFound):
1500+
self.fs.upload("/spam/eggs", bytes_file)
14971501

14981502
def test_upload_chunk_size(self):
14991503
test_data = b"bar" * 128

0 commit comments

Comments
 (0)