MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_islink

Method test_islink

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

Source from the content-addressed store, hash-verified

190 self.assertEqual(posixpath.dirname(b"//foo//bar"), b"//foo")
191
192 def test_islink(self):
193 self.assertIs(posixpath.islink(TESTFN + "1"), False)
194 self.assertIs(posixpath.lexists(TESTFN + "2"), False)
195
196 self.addCleanup(os_helper.unlink, TESTFN + "1")
197 with open(TESTFN + "1", "wb") as f:
198 f.write(b"foo")
199 self.assertIs(posixpath.islink(TESTFN + "1"), False)
200
201 if os_helper.can_symlink():
202 self.addCleanup(os_helper.unlink, TESTFN + "2")
203 os.symlink(TESTFN + "1", TESTFN + "2")
204 self.assertIs(posixpath.islink(TESTFN + "2"), True)
205 os.remove(TESTFN + "1")
206 self.assertIs(posixpath.islink(TESTFN + "2"), True)
207 self.assertIs(posixpath.exists(TESTFN + "2"), False)
208 self.assertIs(posixpath.lexists(TESTFN + "2"), True)
209
210 def test_islink_invalid_paths(self):
211 self.assertIs(posixpath.islink(TESTFN + "\udfff"), False)

Callers

nothing calls this directly

Calls 8

islinkMethod · 0.80
addCleanupMethod · 0.80
openFunction · 0.50
assertIsMethod · 0.45
lexistsMethod · 0.45
writeMethod · 0.45
removeMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected