summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/dos-8x3/configpa.py4
-rw-r--r--Lib/dos-8x3/testntpa.py41
2 files changed, 44 insertions, 1 deletions
diff --git a/Lib/dos-8x3/configpa.py b/Lib/dos-8x3/configpa.py
index bc646e4..dd8b6d8 100644
--- a/Lib/dos-8x3/configpa.py
+++ b/Lib/dos-8x3/configpa.py
@@ -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
index 0000000..9c79865
--- /dev/null
+++ b/Lib/dos-8x3/testntpa.py
@@ -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."
+