Skip to content

Commit 38ce127

Browse files
Tests for RemoteOperations methods isdir and isfile are updated
1 parent 9f52743 commit 38ce127

File tree

1 file changed

+47
-3
lines changed

1 file changed

+47
-3
lines changed

tests/test_remote.py

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,18 +259,62 @@ def test_isfile_true(self):
259259
"""
260260
Test isfile for an existing file.
261261
"""
262-
filename = "/etc/hosts"
262+
filename = __file__
263263

264264
response = self.operations.isfile(filename)
265265

266266
assert response is True
267267

268-
def test_isfile_false(self):
268+
def test_isfile_false__not_exist(self):
269269
"""
270270
Test isfile for a non-existing file.
271271
"""
272-
filename = "/nonexistent_file.txt"
272+
filename = os.path.join(os.path.dirname(__file__), "nonexistent_file.txt")
273273

274274
response = self.operations.isfile(filename)
275275

276276
assert response is False
277+
278+
def test_isfile_false__directory(self):
279+
"""
280+
Test isfile for a firectory.
281+
"""
282+
name = os.path.dirname(__file__)
283+
284+
assert self.operations.isdir(name)
285+
286+
response = self.operations.isfile(name)
287+
288+
assert response is False
289+
290+
def test_isdir_true(self):
291+
"""
292+
Test isdir for an existing directory.
293+
"""
294+
name = os.path.dirname(__file__)
295+
296+
response = self.operations.isdir(name)
297+
298+
assert response is True
299+
300+
def test_isdir_false__not_exist(self):
301+
"""
302+
Test isdir for a non-existing directory.
303+
"""
304+
name = os.path.join(os.path.dirname(__file__), "it_is_nonexistent_directory")
305+
306+
response = self.operations.isdir(name)
307+
308+
assert response is False
309+
310+
def test_isdir_false__file(self):
311+
"""
312+
Test isdir for a file.
313+
"""
314+
name = __file__
315+
316+
assert self.operations.isfile(name)
317+
318+
response = self.operations.isdir(name)
319+
320+
assert response is False

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy