summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-10-08 14:07:56 (GMT)
committerGuido van Rossum <guido@python.org>1996-10-08 14:07:56 (GMT)
commitedaf1c931cb82bf8d27d78240eb7a30b0eb1a797 (patch)
tree4dd703ef6d7cac2c326f9e000b27273dba987293 /Lib/test
parent3159e1e1efb87af30b34732ccc42cbd972ba1116 (diff)
downloadcpython-edaf1c931cb82bf8d27d78240eb7a30b0eb1a797.zip
cpython-edaf1c931cb82bf8d27d78240eb7a30b0eb1a797.tar.gz
cpython-edaf1c931cb82bf8d27d78240eb7a30b0eb1a797.tar.bz2
Simple test module for strop.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_strop.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/test/test_strop.py b/Lib/test/test_strop.py
new file mode 100644
index 0000000..5b2ddfb
--- /dev/null
+++ b/Lib/test/test_strop.py
@@ -0,0 +1,21 @@
+import strop, sys
+
+def test(name, input, output):
+ f = getattr(strop, name)
+ try:
+ value = f(input)
+ except:
+ value = sys.exc_type
+ print sys.exc_value
+ if value != output:
+ print f, `input`, `output`, `value`
+
+test('atoi', " 1 ", 1)
+test('atoi', " 1x", ValueError)
+test('atoi', " x1 ", ValueError)
+test('atol', " 1 ", 1L)
+test('atol', " 1x ", ValueError)
+test('atol', " x1 ", ValueError)
+test('atof', " 1 ", 1.0)
+test('atof', " 1x ", ValueError)
+test('atof', " x1 ", ValueError)