home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / MacHacksBug / Python 1.5.2c1 / Lib / test / test_ntpath.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2000-06-23  |  1.7 KB  |  39 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 1.5)
  3.  
  4. import ntpath
  5. import string
  6. errors = 0
  7.  
  8. def tester(fn, wantResult):
  9.     global errors
  10.     fn = string.replace(fn, '\\', '\\\\')
  11.     gotResult = eval(fn)
  12.     if wantResult != gotResult:
  13.         print 'error!'
  14.         print 'evaluated: ' + str(fn)
  15.         print 'should be: ' + str(wantResult)
  16.         print ' returned: ' + str(gotResult)
  17.         print ''
  18.         errors = errors + 1
  19.     
  20.  
  21. tester('ntpath.splitdrive("c:\\foo\\bar")', ('c:', '\\foo\\bar'))
  22. tester('ntpath.splitunc("\\\\conky\\mountpoint\\foo\\bar")', ('\\\\conky\\mountpoint', '\\foo\\bar'))
  23. tester('ntpath.splitdrive("c:/foo/bar")', ('c:', '/foo/bar'))
  24. tester('ntpath.splitunc("//conky/mountpoint/foo/bar")', ('//conky/mountpoint', '/foo/bar'))
  25. tester('ntpath.split("c:\\foo\\bar")', ('c:\\foo', 'bar'))
  26. tester('ntpath.split("\\\\conky\\mountpoint\\foo\\bar")', ('\\\\conky\\mountpoint\\foo', 'bar'))
  27. tester('ntpath.split("c:\\")', ('c:\\', ''))
  28. tester('ntpath.split("\\\\conky\\mountpoint\\")', ('\\\\conky\\mountpoint', ''))
  29. tester('ntpath.split("c:/")', ('c:/', ''))
  30. tester('ntpath.split("//conky/mountpoint/")', ('//conky/mountpoint', ''))
  31. tester('ntpath.isabs("c:\\")', 1)
  32. tester('ntpath.isabs("\\\\conky\\mountpoint\\")', 1)
  33. tester('ntpath.isabs("\\foo")', 1)
  34. tester('ntpath.isabs("\\foo\\bar")', 1)
  35. if errors:
  36.     print str(errors) + ' errors.'
  37. else:
  38.     print 'No errors.  Thank your lucky stars.'
  39.