diff options
Diffstat (limited to 'Lib/test/test_contextlib.py')
-rw-r--r-- | Lib/test/test_contextlib.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py index a5d68a99f8..adafc9fd4f 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: |