diff options
author | Barney Gale <barney.gale@gmail.com> | 2021-05-21 11:54:56 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-21 11:54:56 (GMT) |
commit | ee51c56c02d8eac28828a116fa35064919433d20 (patch) | |
tree | 08d29ec20c20886f876809b1896edc51f08cb48f /Lib/test/test_pathlib.py | |
parent | 36843f716df7cfa67ea7cd858acb0df1fc5e980e (diff) | |
download | cpython-ee51c56c02d8eac28828a116fa35064919433d20.zip cpython-ee51c56c02d8eac28828a116fa35064919433d20.tar.gz cpython-ee51c56c02d8eac28828a116fa35064919433d20.tar.bz2 |
[3.10] bpo-38671: Add test that `pathlib.Path.resolve()` returns an absolute path. (GH-26184) (GH-26270)
Issue should be fixed in [bpo-43757]()
Co-Authored-by: Tzu-ping Chung <uranusjr@gmail.com>
(cherry picked from commit 18f41c04ff4161531f4d08631059fd3ed37c0218)
Co-authored-by: Barney Gale <barney.gale@gmail.com>
Automerge-Triggered-By: GH:encukou
Diffstat (limited to 'Lib/test/test_pathlib.py')
-rw-r--r-- | Lib/test/test_pathlib.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py index 55d63d5..54b7977 100644 --- a/Lib/test/test_pathlib.py +++ b/Lib/test/test_pathlib.py @@ -1799,6 +1799,16 @@ class _BasePathTest(object): # Non-strict self.assertEqual(r.resolve(strict=False), p / '3' / '4') + def test_resolve_nonexist_relative_issue38671(self): + p = self.cls('non', 'exist') + + old_cwd = os.getcwd() + os.chdir(BASE) + try: + self.assertEqual(p.resolve(), self.cls(BASE, p)) + finally: + os.chdir(old_cwd) + def test_with(self): p = self.cls(BASE) it = p.iterdir() |