blob: 5b2ddfb3d86efacb87a7d35ac06b5f815f73497c [file] [log] [blame]
Guido van Rossum28d4ba21996-09-11 19:07:45 +00001import strop, sys
2
3def test(name, input, output):
4 f = getattr(strop, name)
5 try:
6 value = f(input)
7 except:
8 value = sys.exc_type
9 print sys.exc_value
10 if value != output:
11 print f, `input`, `output`, `value`
12
13test('atoi', " 1 ", 1)
14test('atoi', " 1x", ValueError)
15test('atoi', " x1 ", ValueError)
16test('atol', " 1 ", 1L)
17test('atol', " 1x ", ValueError)
18test('atol', " x1 ", ValueError)
19test('atof', " 1 ", 1.0)
20test('atof', " 1x ", ValueError)
21test('atof', " x1 ", ValueError)