[pypy-svn] r15562 - pypy/dist/pypy/translator/llvm2/test

rxe at codespeak.net rxe at codespeak.net
Wed Aug 3 16:52:01 CEST 2005


Author: rxe
Date: Wed Aug  3 16:52:00 2005
New Revision: 15562

Modified:
   pypy/dist/pypy/translator/llvm2/test/test_exception.py
Log:
Raising an exception in outside function and then caught by Exception.



Modified: pypy/dist/pypy/translator/llvm2/test/test_exception.py
==============================================================================
--- pypy/dist/pypy/translator/llvm2/test/test_exception.py	(original)
+++ pypy/dist/pypy/translator/llvm2/test/test_exception.py	Wed Aug  3 16:52:00 2005
@@ -198,7 +198,26 @@
     assert f(6) == fn(6)
     assert f(13) == fn(13)
 
-def test_try_raise_choose():
-    f = compile_function(try_raise_choose, [int])
-    for i in [-1, 0, 1, 2]:
-        assert f(i) == i
+def test_raise_outside_testfn():
+    def raiser(n):
+        if n < 0:
+            raise ValueError("hello")
+        else:
+            raise MyException("world")
+
+    def intermediate(n):
+        raiser(n)
+        
+    def testfn(n):
+        try:
+            intermediate(n)
+        except ValueError:
+            return 1
+        except Exception:
+            return 2
+        return 0
+    
+    f = compile_function(testfn, [int], view=True)
+    assert f(1) == testfn(1)
+    assert f(-1) == testfn(-1)
+



More information about the Pypy-commit mailing list