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('dospath.splitdrive("c:\\foo\\bar")', ('c:', '\\foo\\bar'))
20 tester('dospath.splitdrive("c:/foo/bar")', ('c:', '/foo/bar'))
22 tester('dospath.split("c:\\foo\\bar")', ('c:\\foo', 'bar'))
23 tester('dospath.split("\\\\conky\\mountpoint\\foo\\bar")', ('\\\\conky\\mountpoint\\foo', 'bar'))
25 tester('dospath.split("c:\\")', ('c:\\', ''))
26 tester('dospath.split("\\\\conky\\mountpoint\\")', ('\\\\conky\\mountpoint', ''))
28 tester('dospath.split("c:/")', ('c:/', ''))
29 tester('dospath.split("//conky/mountpoint/")', ('//conky/mountpoint', ''))
31 tester('dospath.isabs("c:\\")', 1)
32 tester('dospath.isabs("\\\\conky\\mountpoint\\")', 1)
33 tester('dospath.isabs("\\foo")', 1)
34 tester('dospath.isabs("\\foo\\bar")', 1)
36 tester('dospath.abspath("C:\\")', "C:\\")
38 tester('dospath.commonprefix(["/home/swenson/spam", "/home/swen/spam"])',
40 tester('dospath.commonprefix(["\\home\\swen\\spam", "\\home\\swen\\eggs"])',
42 tester('dospath.commonprefix(["/home/swen/spam", "/home/swen/spam"])',
46 print str(errors
) + " errors."
48 print "No errors. Thank your lucky stars."