1 # Python test set -- part 5, built-in exceptions
3 from test_support
import *
4 from types
import ClassType
6 print '5. Built-in exceptions'
7 # XXX This is not really enough, each *operation* should be tested!
10 if type(thing
) == ClassType
:
17 try: x
= sys
.undefined_attribute
18 except AttributeError: pass
22 fp
= open(TESTFN
, 'w')
24 fp
= open(TESTFN
, 'r')
37 try: open('this file does not exist', 'r')
41 try: import undefined_module
42 except ImportError: pass
47 except IndexError: pass
55 print '(not testable in a script)'
58 print '(not safe to test)'
61 try: x
= undefined_variable
62 except NameError: pass
68 except OverflowError: pass
71 print '(not used any more?)'
75 except SyntaxError: pass
78 print '(hard to reproduce)'
83 except SystemExit: pass
87 except TypeError: pass
91 except ValueError: pass
95 except ZeroDivisionError: pass