Commit 04c97f5a authored by Guido van Rossum's avatar Guido van Rossum

Simple test module for strop.

parent 404c0a95
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)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment