Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9f52743

Browse files
Tests for LocalOperations methods isdir and isfile are added
1 parent2f3fc40 commit9f52743

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

‎tests/test_local.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,67 @@ def test_get_file_size__unk_file(self):
118118

119119
withpytest.raises(FileNotFoundError,match=re.escape("[Errno 2] No such file or directory: '/dummy'")):
120120
self.operations.get_file_size("/dummy")
121+
122+
deftest_isfile_true(self):
123+
"""
124+
Test isfile for an existing file.
125+
"""
126+
filename=__file__
127+
128+
response=self.operations.isfile(filename)
129+
130+
assertresponseisTrue
131+
132+
deftest_isfile_false__not_exist(self):
133+
"""
134+
Test isfile for a non-existing file.
135+
"""
136+
filename=os.path.join(os.path.dirname(__file__),"nonexistent_file.txt")
137+
138+
response=self.operations.isfile(filename)
139+
140+
assertresponseisFalse
141+
142+
deftest_isfile_false__directory(self):
143+
"""
144+
Test isfile for a firectory.
145+
"""
146+
name=os.path.dirname(__file__)
147+
148+
assertself.operations.isdir(name)
149+
150+
response=self.operations.isfile(name)
151+
152+
assertresponseisFalse
153+
154+
deftest_isdir_true(self):
155+
"""
156+
Test isdir for an existing directory.
157+
"""
158+
name=os.path.dirname(__file__)
159+
160+
response=self.operations.isdir(name)
161+
162+
assertresponseisTrue
163+
164+
deftest_isdir_false__not_exist(self):
165+
"""
166+
Test isdir for a non-existing directory.
167+
"""
168+
name=os.path.join(os.path.dirname(__file__),"it_is_nonexistent_directory")
169+
170+
response=self.operations.isdir(name)
171+
172+
assertresponseisFalse
173+
174+
deftest_isdir_false__file(self):
175+
"""
176+
Test isdir for a file.
177+
"""
178+
name=__file__
179+
180+
assertself.operations.isfile(name)
181+
182+
response=self.operations.isdir(name)
183+
184+
assertresponseisFalse

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp