/tags/rel-1-3-25/SWIG/Examples/test-suite/python/exception_order_runme.py

# · Python · 26 lines · 20 code · 6 blank · 0 comment · 7 complexity · 36b1c9827941b27a502c96b50a8f61e9 MD5 · raw file

  1. from exception_order import *
  2. a = A()
  3. try:
  4. a.foo()
  5. except E1,e:
  6. pass
  7. except:
  8. raise RuntimeError, "bad exception order"
  9. try:
  10. a.bar()
  11. except E2,e:
  12. pass
  13. except:
  14. raise RuntimeError, "bad exception order"
  15. try:
  16. a.foobar()
  17. except RuntimeError,e:
  18. if e.args[0] != "postcatch unknown":
  19. print "bad exception order",
  20. raise RuntimeError, e.args