Skip to content

Commit

Permalink
Add test with deep path
Browse files Browse the repository at this point in the history
Note that parent directories are not created explicitly
  • Loading branch information
jamesmyatt committed Jun 8, 2020
1 parent 406626d commit 6eb9574
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions adlfs/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,32 @@ def test_mkdir_rm_recursive(storage):
assert fs.find("test_mkdir_rm_recursive") == []


def test_deep_paths(storage):
fs = adlfs.AzureBlobFileSystem(
account_name=storage.account_name, connection_string=CONN_STR
)

fs.mkdir("test_deep")
assert "test_deep/" in fs.ls("")

with fs.open("test_deep/a/b/c/file.txt", "wb") as f:
f.write(b"0123456789")

assert fs.ls("test_deep") == ["test_deep/a/"]
assert fs.ls("test_deep/") == ["test_deep/a/"]
assert fs.ls("test_deep/a") == ["test_deep/a/b/"]
assert fs.ls("test_deep/a/") == ["test_deep/a/b/"]
assert fs.find("test_deep") == ["test_deep/a/b/c/file.txt"]
assert fs.find("test_deep/") == ["test_deep/a/b/c/file.txt"]
assert fs.find("test_deep/a") == ["test_deep/a/b/c/file.txt"]
assert fs.find("test_deep/a/") == ["test_deep/a/b/c/file.txt"]

fs.rm("test_deep", recursive=True)

assert "test_deep/" not in fs.ls("")
assert fs.find("test_deep") == []


def test_large_blob(storage):
import tempfile
import hashlib
Expand Down

0 comments on commit 6eb9574

Please sign in to comment.