7 def tester(fn
, wantResult
):
8 fn
= string
.replace(fn
, "\\", "\\\\")
10 if wantResult
!= gotResult
:
12 print "evaluated: " + str(fn
)
13 print "should be: " + str(wantResult
)
14 print " returned: " + str(gotResult
)
19 tester('ntpath.splitdrive("c:\\foo\\bar")', ('c:', '\\foo\\bar'))
20 tester('ntpath.splitunc("\\\\conky\\mountpoint\\foo\\bar")', ('\\\\conky\\mountpoint', '\\foo\\bar'))
21 tester('ntpath.splitdrive("c:/foo/bar")', ('c:', '/foo/bar'))
22 tester('ntpath.splitunc("//conky/mountpoint/foo/bar")', ('//conky/mountpoint', '/foo/bar'))
24 tester('ntpath.split("c:\\foo\\bar")', ('c:\\foo', 'bar'))
25 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', ''))
30 tester('ntpath.split("c:/")', ('c:/', ''))
31 tester('ntpath.split("//conky/mountpoint/")', ('//conky/mountpoint', ''))
33 tester('ntpath.isabs("c:\\")', 1)
34 tester('ntpath.isabs("\\\\conky\\mountpoint\\")', 1)
35 tester('ntpath.isabs("\\foo")', 1)
36 tester('ntpath.isabs("\\foo\\bar")', 1)
38 tester('ntpath.abspath("C:\\")', "C:\\")
40 tester('ntpath.commonprefix(["/home/swenson/spam", "/home/swen/spam"])',
42 tester('ntpath.commonprefix(["\\home\\swen\\spam", "\\home\\swen\\eggs"])',
44 tester('ntpath.commonprefix(["/home/swen/spam", "/home/swen/spam"])',
48 print str(errors
) + " errors."
50 print "No errors. Thank your lucky stars."