From 9b6760225a21e336418a55a86f3b6dfdc37cef56 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Thu, 21 Aug 2008 17:00:40 +0000 Subject: [PATCH] move test to a better location --- Lib/test/test_exceptions.py | 21 --------------------- Lib/test/test_raise.py | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py index 6075b8dc66..c7de97c731 100644 --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -564,27 +564,6 @@ class ExceptionTests(unittest.TestCase): 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, diff --git a/Lib/test/test_raise.py b/Lib/test/test_raise.py index ba9cfc54d6..4537e9afcf 100644 --- a/Lib/test/test_raise.py +++ b/Lib/test/test_raise.py @@ -302,6 +302,28 @@ class TestContext(unittest.TestCase): 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): -- 2.40.0