summaryrefslogtreecommitdiff
path: root/Lib/test/test_ntpath.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-08-30 22:05:26 +0000
committerTim Peters <tim.peters@gmail.com>2001-08-30 22:05:26 +0000
commit191e5297febe69b06efea0d9165a94b8b67757b4 (patch)
tree85d4b443fa75ab6eab126720fbc94c31ae657bbd /Lib/test/test_ntpath.py
parentae45738a90452f5e0bea0acfbb0b040ec05125ec (diff)
downloadcpython-191e5297febe69b06efea0d9165a94b8b67757b4.tar.gz
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 fe997b3128..049bbc1c26 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: