MCPcopy Index your code
hub / github.com/python/cpython / test_isdir

Method test_isdir

Lib/test/test_genericpath.py:185–208  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

183 self.pathmodule.exists(fd)
184
185 def test_isdir(self):
186 filename = os_helper.TESTFN
187 bfilename = os.fsencode(filename)
188 self.assertIs(self.pathmodule.isdir(filename), False)
189 self.assertIs(self.pathmodule.isdir(bfilename), False)
190
191 self.assertIs(self.pathmodule.isdir(filename + '\udfff'), False)
192 self.assertIs(self.pathmodule.isdir(bfilename + b'\xff'), False)
193 self.assertIs(self.pathmodule.isdir(filename + '\x00'), False)
194 self.assertIs(self.pathmodule.isdir(bfilename + b'\x00'), False)
195
196 try:
197 create_file(filename)
198 self.assertIs(self.pathmodule.isdir(filename), False)
199 self.assertIs(self.pathmodule.isdir(bfilename), False)
200 finally:
201 os_helper.unlink(filename)
202
203 try:
204 os.mkdir(filename)
205 self.assertIs(self.pathmodule.isdir(filename), True)
206 self.assertIs(self.pathmodule.isdir(bfilename), True)
207 finally:
208 os_helper.rmdir(filename)
209
210 def test_isfile(self):
211 filename = os_helper.TESTFN

Callers

nothing calls this directly

Calls 6

rmdirMethod · 0.80
create_fileFunction · 0.70
assertIsMethod · 0.45
isdirMethod · 0.45
unlinkMethod · 0.45
mkdirMethod · 0.45

Tested by

no test coverage detected