/trunk/Examples/test-suite/python/exception_order_runme.py
Python | 43 lines | 32 code | 9 blank | 2 comment | 11 complexity | b41cb80dbed84c5ca71e46786a392e7d MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
- from exception_order import *
- # This test is expected to fail with -builtin option.
- # Throwing builtin classes as exceptions not supported
- a = A()
- try:
- a.foo()
- except E1,e:
- pass
- except:
- raise RuntimeError, "bad exception order"
- try:
- a.bar()
- except E2,e:
- pass
- except:
- raise RuntimeError, "bad exception order"
- try:
- a.foobar()
- except RuntimeError,e:
- if e.args[0] != "postcatch unknown":
- print "bad exception order",
- raise RuntimeError, e.args
- try:
- a.barfoo(1)
- except E1,e:
- pass
- except:
- raise RuntimeError, "bad exception order"
- try:
- a.barfoo(2)
- except E2,e:
- pass
- except:
- raise RuntimeError, "bad exception order"