summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_contextlib.py
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2015-05-22 15:16:47 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2015-05-22 15:16:47 (GMT)
commit683333955a05a31da5f0b2ca1b3bffb9962fb4b2 (patch)
tree236016d773133c19e57c14fc69144e46a586549d /Lib/test/test_contextlib.py
parente79ec70801e410de9c3110ffe78f98e08114ae16 (diff)
downloadcpython-683333955a05a31da5f0b2ca1b3bffb9962fb4b2.zip
cpython-683333955a05a31da5f0b2ca1b3bffb9962fb4b2.tar.gz
cpython-683333955a05a31da5f0b2ca1b3bffb9962fb4b2.tar.bz2
Issue 24237: Raise PendingDeprecationWarning per PEP 479
Raise PendingDeprecationWarning when generator raises StopIteration and no __future__ import is used. Fix offenders in the stdlib and tests. See also issue 22906. Thanks to Nick Coghlan and Berker Peksag for reviews.
Diffstat (limited to 'Lib/test/test_contextlib.py')
-rw-r--r--Lib/test/test_contextlib.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py
index a5d68a9..adafc9f 100644
--- a/Lib/test/test_contextlib.py
+++ b/Lib/test/test_contextlib.py
@@ -89,8 +89,10 @@ class ContextManagerTestCase(unittest.TestCase):
def woohoo():
yield
try:
- with woohoo():
- raise stop_exc
+ with self.assertWarnsRegex(PendingDeprecationWarning,
+ "StopIteration"):
+ with woohoo():
+ raise stop_exc
except Exception as ex:
self.assertIs(ex, stop_exc)
else: