[pypy-commit] pypy py3k: two more tests from cpython's test suite. The first passes, the second is failing

antocuni noreply at buildbot.pypy.org
Tue Feb 14 17:28:16 CET 2012


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k
Changeset: r52464:639f68fb00e9
Date: 2012-02-14 14:11 +0100
http://bitbucket.org/pypy/pypy/changeset/639f68fb00e9/

Log:	two more tests from cpython's test suite. The first passes, the
	second is failing

diff --git a/pypy/interpreter/test/test_raise.py b/pypy/interpreter/test/test_raise.py
--- a/pypy/interpreter/test/test_raise.py
+++ b/pypy/interpreter/test/test_raise.py
@@ -171,6 +171,38 @@
                 nested_reraise()
         """)
 
+    def test_with_reraise_1(self):
+        class Context:
+            def __enter__(self):
+                return self
+            def __exit__(self, exc_type, exc_value, exc_tb):
+                return True
+
+        def fn():
+            try:
+                raise ValueError("foo")
+            except:
+                with Context():
+                    pass
+                raise
+        raises(ValueError, "fn()")
+
+
+    def test_with_reraise_2(self):
+        class Context:
+            def __enter__(self):
+                return self
+            def __exit__(self, exc_type, exc_value, exc_tb):
+                return True
+
+        def fn():
+            try:
+                raise ValueError("foo")
+            except:
+                with Context():
+                    raise KeyError("caught")
+                raise
+        raises(ValueError, "fn()")
 
     def test_userclass(self):
         # new-style classes can't be raised unless they inherit from


More information about the pypy-commit mailing list