diff options
-rw-r--r-- | Lib/test/test_opcodes.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Lib/test/test_opcodes.py b/Lib/test/test_opcodes.py index 4cc6ee9..b1e944b 100644 --- a/Lib/test/test_opcodes.py +++ b/Lib/test/test_opcodes.py @@ -21,3 +21,39 @@ for i in range(10): n = n+i if n <> 90: raise TestFailed, 'try inside for' + + +print '2.2 raise class exceptions' + +class AClass: pass +class BClass(AClass): pass +class CClass: pass + +try: raise AClass() +except: pass + +try: raise AClass() +except AClass: pass + +try: raise BClass() +except AClass: pass + +try: raise BClass() +except CClass: raise TestFailed +except: pass + +a = AClass() +b = BClass() + +try: raise AClass, b +except BClass, v: raise TestFailed +except AClass, v: + if v != b: raise TestFailed + + +try: raise b +except AClass, v: + if v != b: raise TestFailed + +try: raise BClass, a +except TypeError: pass |