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

Tim Peters tim_one@users.sourceforge.net
Thu, 19 Jul 2001 12:11:44 -0700


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

Modified Files:
	test_ntpath.py 
Log Message:
Add some test cases for ntpath.join().


Index: test_ntpath.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_ntpath.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** test_ntpath.py	2001/07/19 19:02:12	1.8
--- test_ntpath.py	2001/07/19 19:11:41	1.9
***************
*** 1,4 ****
  import ntpath
! from test_support import verbose
  import os
  
--- 1,4 ----
  import ntpath
! from test_support import verbose, TestFailed
  import os
  
***************
*** 6,9 ****
--- 6,10 ----
  
  def tester(fn, wantResult):
+     global errors
      fn = fn.replace("\\", "\\\\")
      gotResult = eval(fn)
***************
*** 14,18 ****
          print " returned: " + str(gotResult)
          print ""
-         global errors
          errors = errors + 1
  
--- 15,18 ----
***************
*** 51,56 ****
         "/home/swen/spam")
  
  if errors:
!     print str(errors) + " errors."
  elif verbose:
      print "No errors.  Thank your lucky stars."
--- 51,72 ----
         "/home/swen/spam")
  
+ tester('ntpath.join("")', '')
+ tester('ntpath.join("", "", "")', '')
+ tester('ntpath.join("a")', 'a')
+ tester('ntpath.join("/a")', '/a')
+ tester('ntpath.join("\\a")', '\\a')
+ tester('ntpath.join("a:")', 'a:')
+ tester('ntpath.join("a:", "b")', 'a:b')
+ tester('ntpath.join("a:", "/b")', 'a:/b')
+ tester('ntpath.join("a:", "\\b")', 'a:\\b')
+ tester('ntpath.join("a", "/b")', '/b')
+ tester('ntpath.join("a", "\\b")', '\\b')
+ tester('ntpath.join("a", "b", "c")', 'a\\b\\c')
+ tester('ntpath.join("a\\", "b", "c")', 'a\\b\\c')
+ tester('ntpath.join("a", "b\\", "c")', 'a\\b\\c')
+ tester('ntpath.join("a", "b", "\\c")', '\\c')
+ 
  if errors:
!     raise TestFailed(str(errors) + " errors.")
  elif verbose:
      print "No errors.  Thank your lucky stars."