summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_raise.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-08-21 17:00:40 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-08-21 17:00:40 (GMT)
commit9b6760225a21e336418a55a86f3b6dfdc37cef56 (patch)
tree1287bcb6191912d396b75c382ed5198ff637b39f /Lib/test/test_raise.py
parentf9aefce634f2107454ffff4d6b092e01d04b89c8 (diff)
downloadcpython-9b6760225a21e336418a55a86f3b6dfdc37cef56.zip
cpython-9b6760225a21e336418a55a86f3b6dfdc37cef56.tar.gz
cpython-9b6760225a21e336418a55a86f3b6dfdc37cef56.tar.bz2
move test to a better location
Diffstat (limited to 'Lib/test/test_raise.py')
-rw-r--r--Lib/test/test_raise.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/Lib/test/test_raise.py b/Lib/test/test_raise.py
index ba9cfc5..4537e9a 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):