summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_posixpath.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_posixpath.py')
-rw-r--r--Lib/test/test_posixpath.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py
index 9476ede..ae59ef5 100644
--- a/Lib/test/test_posixpath.py
+++ b/Lib/test/test_posixpath.py
@@ -153,9 +153,11 @@ class PosixPathTest(unittest.TestCase):
def test_islink(self):
self.assertIs(posixpath.islink(support.TESTFN + "1"), False)
self.assertIs(posixpath.lexists(support.TESTFN + "2"), False)
+
with open(support.TESTFN + "1", "wb") as f:
f.write(b"foo")
self.assertIs(posixpath.islink(support.TESTFN + "1"), False)
+
if support.can_symlink():
os.symlink(support.TESTFN + "1", support.TESTFN + "2")
self.assertIs(posixpath.islink(support.TESTFN + "2"), True)
@@ -164,6 +166,11 @@ class PosixPathTest(unittest.TestCase):
self.assertIs(posixpath.exists(support.TESTFN + "2"), False)
self.assertIs(posixpath.lexists(support.TESTFN + "2"), True)
+ self.assertIs(posixpath.islink(support.TESTFN + "\udfff"), False)
+ self.assertIs(posixpath.islink(os.fsencode(support.TESTFN) + b"\xff"), False)
+ self.assertIs(posixpath.islink(support.TESTFN + "\x00"), False)
+ self.assertIs(posixpath.islink(os.fsencode(support.TESTFN) + b"\x00"), False)
+
def test_ismount(self):
self.assertIs(posixpath.ismount("/"), True)
self.assertIs(posixpath.ismount(b"/"), True)
@@ -177,6 +184,11 @@ class PosixPathTest(unittest.TestCase):
finally:
safe_rmdir(ABSTFN)
+ self.assertIs(posixpath.ismount('/\udfff'), False)
+ self.assertIs(posixpath.ismount(b'/\xff'), False)
+ self.assertIs(posixpath.ismount('/\x00'), False)
+ self.assertIs(posixpath.ismount(b'/\x00'), False)
+
@unittest.skipUnless(support.can_symlink(),
"Test requires symlink support")
def test_ismount_symlinks(self):