summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-01-31 16:10:15 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2013-01-31 16:10:15 +0200
commitc5200b489de125088fdc445b5f5c97d7fb98cead (patch)
tree7bb0d27afa884460f8ff831d2407443c07c76574
parent8d510cd6e117b4ec827e4a26947ea76971a55763 (diff)
downloadcpython-git-c5200b489de125088fdc445b5f5c97d7fb98cead.tar.gz
Issue #17041: Fix doctesting when Python is configured with the
--without-doc-strings.
-rw-r--r--Lib/test/test_generators.py3
-rw-r--r--Lib/test/test_genexps.py3
2 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py
index 19bfe074c4..27399f7376 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.
<type 'generator'>
>>> [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 3d896a530f..fc593a3141 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)