bpo-31047: Fix ntpath.abspath for invalid paths (GH-8544)
(cherry picked from commit d2e902e4fb304f27e4a72356efbc1fc26be3935d)
Co-authored-by: Franz Wöllert <franz.woellert@gmail.com>
diff --git a/Lib/test/test_ntpath.py b/Lib/test/test_ntpath.py
index 2d48be8..907ca7e 100644
--- a/Lib/test/test_ntpath.py
+++ b/Lib/test/test_ntpath.py
@@ -280,6 +280,10 @@
@unittest.skipUnless(nt, "abspath requires 'nt' module")
def test_abspath(self):
tester('ntpath.abspath("C:\\")', "C:\\")
+ with support.temp_cwd(support.TESTFN) as cwd_dir: # bpo-31047
+ tester('ntpath.abspath("")', cwd_dir)
+ tester('ntpath.abspath(" ")', cwd_dir + "\\ ")
+ tester('ntpath.abspath("?")', cwd_dir + "\\?")
def test_relpath(self):
tester('ntpath.relpath("a")', 'a')