]> granicus.if.org Git - python/commitdiff
The usual
authorGuido van Rossum <guido@python.org>
Tue, 16 Feb 1999 20:05:35 +0000 (20:05 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 16 Feb 1999 20:05:35 +0000 (20:05 +0000)
Lib/dos-8x3/configpa.py
Lib/dos-8x3/testntpa.py [new file with mode: 0644]

index bc646e41e2bc4e1b176eab14e6f77ae70572d1dd..dd8b6d866726300c035a17abab86967cc109ab55 100644 (file)
@@ -209,7 +209,9 @@ class ConfigParser:
             return rawval
 
         value = rawval                  # Make it a pretty variable name
-        while 1:                        # Loop through this until it's done
+        depth = 0                       
+        while depth < 10:               # Loop through this until it's done
+            depth = depth + 1
             if not string.find(value, "%("):
                 try:
                     value = value % d
diff --git a/Lib/dos-8x3/testntpa.py b/Lib/dos-8x3/testntpa.py
new file mode 100644 (file)
index 0000000..9c79865
--- /dev/null
@@ -0,0 +1,41 @@
+import ntpath
+import string
+
+errors = 0
+
+def tester(fn, wantResult):
+       fn = string.replace(fn, "\\", "\\\\")
+       gotResult = eval(fn)
+       if wantResult != gotResult:
+               print "error!"
+               print "evaluated: " + str(fn)
+               print "should be: " + str(wantResult)
+               print " returned: " + str(gotResult)
+               print ""
+               global errors
+               errors = errors + 1
+
+tester('ntpath.splitdrive("c:\\foo\\bar")', ('c:', '\\foo\\bar'))
+tester('ntpath.splitdrive("\\\\conky\\mountpoint\\foo\\bar")', ('\\\\conky\\mountpoint', '\\foo\\bar'))
+tester('ntpath.splitdrive("c:/foo/bar")', ('c:', '/foo/bar'))
+tester('ntpath.splitdrive("//conky/mountpoint/foo/bar")', ('//conky/mountpoint', '/foo/bar'))
+
+tester('ntpath.split("c:\\foo\\bar")', ('c:\\foo', 'bar'))
+tester('ntpath.split("\\\\conky\\mountpoint\\foo\\bar")', ('\\\\conky\\mountpoint\\foo', 'bar'))
+
+tester('ntpath.split("c:\\")', ('c:\\', ''))
+tester('ntpath.split("\\\\conky\\mountpoint\\")', ('\\\\conky\\mountpoint\\', ''))
+
+tester('ntpath.split("c:/")', ('c:/', ''))
+tester('ntpath.split("//conky/mountpoint/")', ('//conky/mountpoint/', ''))
+
+tester('ntpath.isabs("c:\\")', 1)
+tester('ntpath.isabs("\\\\conky\\mountpoint\\")', 1)
+tester('ntpath.isabs("\\foo")', 1)
+tester('ntpath.isabs("\\foo\\bar")', 1)
+
+if errors:
+       print str(errors) + " errors."
+else:
+       print "No errors.  Thank your lucky stars."
+