Skip to content

Commit 16b0218

Browse files
committed
Add test to create from type
1 parent fffa14a commit 16b0218

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

upath/tests/test_core.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,14 @@ class TestFSSpecLocal(BaseTests):
9797
def path(self, local_testdir):
9898
path = f"file://{local_testdir}"
9999
self.path = UPath(path)
100+
101+
102+
def test_create_from_type(local_testdir):
103+
paths = [local_testdir, "s3://bucket/folder", "gs://bucket/folder"]
104+
for path in paths:
105+
parts = path.split("/")
106+
parent = "/".join(parts[:-1])
107+
upath = UPath(path)
108+
cast = type(upath)
109+
new = cast(parent)
110+
assert isinstance(new, cast)

0 commit comments

Comments
 (0)