summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na92@gmail.com>2018-06-12 14:30:45 (GMT)
committerƁukasz Langa <lukasz@langa.pl>2020-08-27 00:24:38 (GMT)
commit94ad6c674f7687ef22853cb8d42b440d6b42ddc8 (patch)
tree7e5c3858a3178adf6c1353f95611402a92c893a6 /Lib/test
parent82e79480d6e61940d7007d9026fbff0b1a11ad9a (diff)
downloadcpython-94ad6c674f7687ef22853cb8d42b440d6b42ddc8.zip
cpython-94ad6c674f7687ef22853cb8d42b440d6b42ddc8.tar.gz
cpython-94ad6c674f7687ef22853cb8d42b440d6b42ddc8.tar.bz2
bpo-33660: Fix PosixPath to resolve a relative path on root
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_pathlib.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py
index 04f7c3d..2cb6738 100644
--- a/Lib/test/test_pathlib.py
+++ b/Lib/test/test_pathlib.py
@@ -2349,6 +2349,15 @@ class PosixPathTest(_BasePathTest, unittest.TestCase):
st = os.stat(join('other_new_file'))
self.assertEqual(stat.S_IMODE(st.st_mode), 0o644)
+ def test_resolve_root(self):
+ current_directory = os.getcwd()
+ try:
+ os.chdir('/')
+ p = self.cls('spam')
+ self.assertEqual(str(p.resolve()), '/spam')
+ finally:
+ os.chdir(current_directory)
+
def test_touch_mode(self):
old_mask = os.umask(0)
self.addCleanup(os.umask, old_mask)