Commit eae37760 authored by Stefan Behnel's avatar Stefan Behnel

Make a test work in Py3.7 that changed behaviour in Python 3.7...

Make a test work in Py3.7 that changed behaviour in Python 3.7 ("generator_stop" future import became active by default).
parent ccd1a3fe
......@@ -81,17 +81,6 @@ def with_outer(*args):
yield i
return generator
def with_outer_raising(*args):
"""
>>> x = with_outer_raising(1, 2, 3)
>>> list(x())
[1, 2, 3]
"""
def generator():
for i in args:
yield i
raise StopIteration
return generator
def test_close():
"""
......
# mode: run
# tag: generators, pure3.5
from __future__ import generator_stop
# "generator_stop" was only added in Py3.5.
def with_outer_raising(*args):
"""
>>> x = with_outer_raising(1, 2, 3)
>>> try:
... list(x())
... except RuntimeError:
... print("OK!")
... else:
... print("NOT RAISED!")
OK!
"""
def generator():
for i in args:
yield i
raise StopIteration
return generator
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment