[Python-checkins] CVS: python/dist/src/Lib/test test_ntpath.py,1.11,1.12

Tim Peters tim_one@users.sourceforge.net
Thu, 30 Aug 2001 15:05:28 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv29850/python/Lib/test

Modified Files:
	test_ntpath.py 
Log Message:
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.


Index: test_ntpath.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_ntpath.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** test_ntpath.py	2001/07/27 08:09:54	1.11
--- test_ntpath.py	2001/08/30 22:05:26	1.12
***************
*** 75,78 ****
--- 75,102 ----
  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.")