summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_exceptions.py
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2000-06-20 18:52:57 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2000-06-20 18:52:57 (GMT)
commit56c807d318954222bb67167477d98eafb6b85d81 (patch)
tree758ad9fea52b583200b03499bcd62e30b584e2be /Lib/test/test_exceptions.py
parent2d15d9d8696b938bffb24c04fc6cb24259c55f80 (diff)
downloadcpython-56c807d318954222bb67167477d98eafb6b85d81.zip
cpython-56c807d318954222bb67167477d98eafb6b85d81.tar.gz
cpython-56c807d318954222bb67167477d98eafb6b85d81.tar.bz2
add minimal test of exception use. verify that each exception can be
raised, caught, and converted to a string.
Diffstat (limited to 'Lib/test/test_exceptions.py')
-rw-r--r--Lib/test/test_exceptions.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index d172ecd..7bc515c 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -6,7 +6,19 @@ from types import ClassType
print '5. Built-in exceptions'
# XXX This is not really enough, each *operation* should be tested!
+def test_raise_catch(exc):
+ try:
+ raise exc, "spam"
+ except exc, err:
+ buf = str(err)
+ try:
+ raise exc("spam")
+ except exc, err:
+ buf = str(err)
+ print buf
+
def r(thing):
+ test_raise_catch(thing)
if type(thing) == ClassType:
print thing.__name__
else: