cpython/Lib/dos_8x3/test_str.py

21 lines
480 B
Python
Raw Normal View History

1996-09-11 16:07:45 -03:00
import strop, sys
def test(name, input, output):
f = getattr(strop, name)
try:
value = f(input)
except:
value = sys.exc_type
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)