diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py index 19bfe074c4e..27399f73765 100644 --- a/Lib/test/test_generators.py +++ b/Lib/test/test_generators.py @@ -383,7 +383,8 @@ From the Iterators list, about the types of these things. >>> [s for s in dir(i) if not s.startswith('_')] ['close', 'gi_code', 'gi_frame', 'gi_running', 'next', 'send', 'throw'] ->>> print i.next.__doc__ +>>> from test.test_support import HAVE_DOCSTRINGS +>>> print(i.next.__doc__ if HAVE_DOCSTRINGS else 'x.next() -> the next value, or raise StopIteration') x.next() -> the next value, or raise StopIteration >>> iter(i) is i True diff --git a/Lib/test/test_genexps.py b/Lib/test/test_genexps.py index 3d896a530f8..fc593a31416 100644 --- a/Lib/test/test_genexps.py +++ b/Lib/test/test_genexps.py @@ -223,7 +223,8 @@ Check that generator attributes are present >>> set(attr for attr in dir(g) if not attr.startswith('__')) >= expected True - >>> print g.next.__doc__ + >>> from test.test_support import HAVE_DOCSTRINGS + >>> print(g.next.__doc__ if HAVE_DOCSTRINGS else 'x.next() -> the next value, or raise StopIteration') x.next() -> the next value, or raise StopIteration >>> import types >>> isinstance(g, types.GeneratorType)