diff options
author | Yury Selivanov <yury@magic.io> | 2018-01-26 20:24:24 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-26 20:24:24 (GMT) |
commit | 43c47fe09640c579462978ec16f81295f5857cde (patch) | |
tree | 6a1524a805eb5d181acc04552bfb1a09ea736e39 /Lib/test/test_generators.py | |
parent | dba976b8a28d6e5daa66ef31a6a7c694a9193f6a (diff) | |
download | cpython-43c47fe09640c579462978ec16f81295f5857cde.zip cpython-43c47fe09640c579462978ec16f81295f5857cde.tar.gz cpython-43c47fe09640c579462978ec16f81295f5857cde.tar.bz2 |
bpo-32670: Enforce PEP 479. (#5327)
Diffstat (limited to 'Lib/test/test_generators.py')
-rw-r--r-- | Lib/test/test_generators.py | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py index bd17ad4..3461f20 100644 --- a/Lib/test/test_generators.py +++ b/Lib/test/test_generators.py @@ -265,26 +265,16 @@ class ExceptionTest(unittest.TestCase): self.assertEqual(next(g), "done") self.assertEqual(sys.exc_info(), (None, None, None)) - def test_stopiteration_warning(self): + def test_stopiteration_error(self): # See also PEP 479. def gen(): raise StopIteration yield - with self.assertRaises(StopIteration), \ - self.assertWarnsRegex(DeprecationWarning, "StopIteration"): - - next(gen()) - - with self.assertRaisesRegex(DeprecationWarning, - "generator .* raised StopIteration"), \ - warnings.catch_warnings(): - - warnings.simplefilter('error') + with self.assertRaisesRegex(RuntimeError, 'raised StopIteration'): next(gen()) - def test_tutorial_stopiteration(self): # Raise StopIteration" stops the generator too: @@ -296,13 +286,7 @@ class ExceptionTest(unittest.TestCase): g = f() self.assertEqual(next(g), 1) - with self.assertWarnsRegex(DeprecationWarning, "StopIteration"): - with self.assertRaises(StopIteration): - next(g) - - with self.assertRaises(StopIteration): - # This time StopIteration isn't raised from the generator's body, - # hence no warning. + with self.assertRaisesRegex(RuntimeError, 'raised StopIteration'): next(g) def test_return_tuple(self): |