summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ntpath.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-08-30 22:05:26 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-08-30 22:05:26 (GMT)
commit54a14a373e953365d6ca7c0d4e139563d07b52e7 (patch)
tree85a92957202cd5c2e977a0b562e290ef22a697c3 /Lib/test/test_ntpath.py
parent0e03f588f513249fc6e43c94d30210f9d7558468 (diff)
downloadcpython-54a14a373e953365d6ca7c0d4e139563d07b52e7.zip
cpython-54a14a373e953365d6ca7c0d4e139563d07b52e7.tar.gz
cpython-54a14a373e953365d6ca7c0d4e139563d07b52e7.tar.bz2
SF bug #456621: normpath on Win32 not collapsing c:\\..
I actually rewrote normpath quite a bit: it had no test cases, and as soon as I starting writing some I found several cases that didn't make sense.
Diffstat (limited to 'Lib/test/test_ntpath.py')
-rw-r--r--Lib/test/test_ntpath.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/Lib/test/test_ntpath.py b/Lib/test/test_ntpath.py
index fe997b3..049bbc1 100644
--- a/Lib/test/test_ntpath.py
+++ b/Lib/test/test_ntpath.py
@@ -74,6 +74,30 @@ tester("ntpath.join('c:', 'd:/')", 'd:/')
tester("ntpath.join('c:/', 'd:/')", 'd:/')
tester("ntpath.join('c:/', 'd:/a/b')", 'd:/a/b')
+tester("ntpath.normpath('A//////././//.//B')", r'A\B')
+tester("ntpath.normpath('A/./B')", r'A\B')
+tester("ntpath.normpath('A/foo/../B')", r'A\B')
+tester("ntpath.normpath('C:A//B')", r'C:A\B')
+tester("ntpath.normpath('D:A/./B')", r'D:A\B')
+tester("ntpath.normpath('e:A/foo/../B')", r'e:A\B')
+
+# Next 3 seem dubious, and especially the 3rd, but normpath is possibly
+# trying to leave UNC paths alone without actually knowing anything about
+# them.
+tester("ntpath.normpath('C:///A//B')", r'C:\\\A\B')
+tester("ntpath.normpath('D:///A/./B')", r'D:\\\A\B')
+tester("ntpath.normpath('e:///A/foo/../B')", r'e:\\\A\B')
+
+tester("ntpath.normpath('..')", r'..')
+tester("ntpath.normpath('.')", r'.')
+tester("ntpath.normpath('')", r'.')
+tester("ntpath.normpath('/')", '\\')
+tester("ntpath.normpath('c:/')", 'c:\\')
+tester("ntpath.normpath('/../.././..')", '\\')
+tester("ntpath.normpath('c:/../../..')", 'c:\\')
+tester("ntpath.normpath('../.././..')", r'..\..\..')
+tester("ntpath.normpath('K:../.././..')", r'K:..\..\..')
+
if errors:
raise TestFailed(str(errors) + " errors.")
elif verbose: