From 16588229023bc5a3dc07d0386289ed6b3ceeddb7 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sun, 17 Apr 2011 11:45:14 +0200 Subject: [PATCH] added failing exception test for generators --- tests/run/generators_py.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/run/generators_py.py b/tests/run/generators_py.py index ea16659a..ac364234 100644 --- a/tests/run/generators_py.py +++ b/tests/run/generators_py.py @@ -155,6 +155,22 @@ def check_throw(): except ValueError: pass +def check_yield_in_except(): + """ + >>> import sys + >>> orig_exc = sys.exc_info()[0] + >>> g = check_yield_in_except() + >>> next(g) + >>> next(g) + >>> orig_exc is sys.exc_info()[0] or sys.exc_info()[0] + True + """ + try: + yield + raise ValueError + except ValueError: + yield + def test_swap_assignment(): """ >>> gen = test_swap_assignment() -- 2.26.2