From edaf1c931cb82bf8d27d78240eb7a30b0eb1a797 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 8 Oct 1996 14:07:56 +0000 Subject: Simple test module for strop. --- Lib/test/test_strop.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Lib/test/test_strop.py 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) -- cgit v0.12