[Python-3000-checkins] r65933 - in python/branches/py3k/Lib/test: test_exceptions.py test_raise.py

benjamin.peterson python-3000-checkins at python.org
Thu Aug 21 19:00:40 CEST 2008


Author: benjamin.peterson
Date: Thu Aug 21 19:00:40 2008
New Revision: 65933

Log:
move test to a better location

Modified:
   python/branches/py3k/Lib/test/test_exceptions.py
   python/branches/py3k/Lib/test/test_raise.py

Modified: python/branches/py3k/Lib/test/test_exceptions.py
==============================================================================
--- python/branches/py3k/Lib/test/test_exceptions.py	(original)
+++ python/branches/py3k/Lib/test/test_exceptions.py	Thu Aug 21 19:00:40 2008
@@ -564,27 +564,6 @@
             pass
         self.assertEquals(e, (None, None, None))
 
-    def test_3118(self):
-        def gen():
-            try:
-                yield 1
-            finally:
-                pass
-
-        def f():
-            g = gen()
-            next(g)
-            try:
-                try:
-                    raise ValueError
-                except:
-                    del g
-                    raise KeyError
-            except Exception as e:
-                self.assert_(isinstance(e.__context__, ValueError))
-
-        f()
-
 
     def test_badisinstance(self):
         # Bug #2542: if issubclass(e, MyException) raises an exception,

Modified: python/branches/py3k/Lib/test/test_raise.py
==============================================================================
--- python/branches/py3k/Lib/test/test_raise.py	(original)
+++ python/branches/py3k/Lib/test/test_raise.py	Thu Aug 21 19:00:40 2008
@@ -302,6 +302,28 @@
         except NameError as e:
             self.failUnless(e.__context__.__context__ is None)
 
+    def test_3118(self):
+        # deleting the generator caused the __context__ to be cleared
+        def gen():
+            try:
+                yield 1
+            finally:
+                pass
+
+        def f():
+            g = gen()
+            next(g)
+            try:
+                try:
+                    raise ValueError
+                except:
+                    del g
+                    raise KeyError
+            except Exception as e:
+                self.assert_(isinstance(e.__context__, ValueError))
+
+        f()
+
 
 class TestRemovedFunctionality(unittest.TestCase):
     def test_tuples(self):


More information about the Python-3000-checkins mailing list