PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/python/exception_order_runme.py

#
Python | 43 lines | 32 code | 9 blank | 2 comment | 1 complexity | b41cb80dbed84c5ca71e46786a392e7d MD5 | raw file
 1from exception_order import *
 2
 3# This test is expected to fail with -builtin option.
 4# Throwing builtin classes as exceptions not supported
 5
 6a = A()
 7
 8try:
 9  a.foo()
10except E1,e:
11  pass
12except:
13  raise RuntimeError, "bad exception order"
14
15try:
16  a.bar()
17except E2,e:
18  pass
19except:
20  raise RuntimeError, "bad exception order"
21
22try:
23  a.foobar()
24except RuntimeError,e:
25  if e.args[0] != "postcatch unknown":
26    print "bad exception order", 
27    raise RuntimeError, e.args
28
29
30
31try:
32  a.barfoo(1)
33except E1,e:
34  pass
35except:
36  raise RuntimeError, "bad exception order"
37
38try:
39  a.barfoo(2)
40except E2,e:
41  pass
42except:
43  raise RuntimeError, "bad exception order"