summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-02-16 20:05:35 (GMT)
committerGuido van Rossum <guido@python.org>1999-02-16 20:05:35 (GMT)
commit5d856fcd0fc6534903b828b7c6221477603e87ce (patch)
tree230b60795872135c0200120c059b12ad732ac93f /Lib
parent0b0703524980b83cadb7f85a468ba7063d929702 (diff)
downloadcpython-5d856fcd0fc6534903b828b7c6221477603e87ce.zip
cpython-5d856fcd0fc6534903b828b7c6221477603e87ce.tar.gz
cpython-5d856fcd0fc6534903b828b7c6221477603e87ce.tar.bz2
The usual
Diffstat (limited to 'Lib')
-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."
+