blob: 6028b0d92a7d6e7cdadbe8daa7966cbb10e0f98e [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
Guido van Rossum28d4ba21996-09-11 19:07:45 +00009 if value != output:
10 print f, `input`, `output`, `value`
11
12test('atoi', " 1 ", 1)
13test('atoi', " 1x", ValueError)
14test('atoi', " x1 ", ValueError)
15test('atol', " 1 ", 1L)
16test('atol', " 1x ", ValueError)
17test('atol', " x1 ", ValueError)
18test('atof', " 1 ", 1.0)
19test('atof', " 1x ", ValueError)
20test('atof', " x1 ", ValueError)