Skip to content

Commit ab48c4d

Browse files
Merge pull request #53 from scalableminds/is_symlink_false
Adds default implementations for is_symlink etc.
2 parents 651744b + 42c2d7a commit ab48c4d

File tree

2 files changed

+27
-18
lines changed

2 files changed

+27
-18
lines changed

upath/core.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,6 @@ class UPath(pathlib.Path, PureUPath, metaclass=UPathMeta):
109109
"home",
110110
"expanduser",
111111
"group",
112-
"is_mount",
113-
"is_symlink",
114-
"is_socket",
115-
"is_fifo",
116-
"is_block_device",
117-
"is_char_device",
118112
"lchmod",
119113
"lstat",
120114
"owner",
@@ -288,6 +282,27 @@ def is_file(self):
288282
return True
289283
return False
290284

285+
def is_mount(self):
286+
return False
287+
288+
def is_symlink(self):
289+
info = self._accessor.info(self)
290+
if "islink" in info:
291+
return info["islink"]
292+
return False
293+
294+
def is_socket(self):
295+
return False
296+
297+
def is_fifo(self):
298+
return False
299+
300+
def is_block_device(self):
301+
return False
302+
303+
def is_char_device(self):
304+
return False
305+
291306
def chmod(self, mod):
292307
raise NotImplementedError
293308

upath/tests/cases.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,28 +62,22 @@ def test_is_file(self):
6262
assert not self.path.is_file()
6363

6464
def test_is_mount(self):
65-
with pytest.raises(NotImplementedError):
66-
self.path.is_mount()
65+
assert self.path.is_mount() is False
6766

6867
def test_is_symlink(self):
69-
with pytest.raises(NotImplementedError):
70-
self.path.is_symlink()
68+
assert self.path.is_symlink() is False
7169

7270
def test_is_socket(self):
73-
with pytest.raises(NotImplementedError):
74-
self.path.is_socket()
71+
assert self.path.is_socket() is False
7572

7673
def test_is_fifo(self):
77-
with pytest.raises(NotImplementedError):
78-
self.path.is_fifo()
74+
assert self.path.is_fifo() is False
7975

8076
def test_is_block_device(self):
81-
with pytest.raises(NotImplementedError):
82-
self.path.is_block_device()
77+
assert self.path.is_block_device() is False
8378

8479
def test_is_char_device(self):
85-
with pytest.raises(NotImplementedError):
86-
self.path.is_char_device()
80+
assert self.path.is_char_device() is False
8781

8882
def test_iterdir(self, local_testdir):
8983
pl_path = Path(local_testdir)

0 commit comments

Comments
 (0)