bpo-31047: Fix ntpath.abspath for invalid paths (GH-8544)

diff --git a/Lib/test/test_ntpath.py b/Lib/test/test_ntpath.py
index 1e85ad5..f37a994 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')