1 # Python test set -- part 5, built-in exceptions
3 from test_support
import *
5 print '5. Built-in exceptions'
6 # XXX This is not really enough, each *operation* should be tested!
8 def r(name
): print name
12 try: x
= sys
.undefined_attribute
13 except AttributeError: pass
17 fp
= open(TESTFN
, 'w')
19 fp
= open(TESTFN
, 'r')
32 try: open('this file does not exist', 'r')
36 try: import undefined_module
37 except ImportError: pass
42 except IndexError: pass
50 print '(not testable in a script)'
53 print '(not safe to test)'
56 try: x
= undefined_variable
57 except NameError: pass
63 except OverflowError: pass
66 print '(not used any more?)'
70 except SyntaxError: pass
73 print '(hard to reproduce)'
78 except SystemExit: pass
82 except TypeError: pass
86 except ValueError: pass
90 except ZeroDivisionError: pass