On 5/20/2012 12:33 PM, Vincent Vande Vyvre wrote:
On 20/05/12 17:55, Steven D'Aprano wrote:
Is this a bug in the doctest documentation, or is my browser broken?
On this page:
http://docs.python.org/library/doctest.html#option-flags-and-directives
scroll down to the examples showing the doctest directives, e.g:
[quote]
For example, this test passes:
>>> print range(20)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
Likewise for the Python 3 version:
http://docs.python.org/py3k/library/doctest.html
Seems to me that the actual directives are missing. I can't see them in
the raw HTML either. Can anyone else confirm that they are missing?
No, this paragraph exists.
Copied from source of http://docs.python.org/py3k/library/doctest.html:
An example's doctest directives modify doctest's behavior for that single
example. Use ``+`` to enable the named behavior, or ``-`` to disable it.
For example, this test passes::
>>> print(list(range(20))) #doctest: +NORMALIZE_WHITESPACE
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
The directives may be in the source, but they seem to be getting removed
when the docs are built. They are also missing from the Windows help
version. I suspect that sphinx now uses the directives itself for
doctest testing examples, and does not know to leave them. I opened an
issue.
http://bugs.python.org/issue14865
I determined that the removing bug first happened with 3.2.0 and then
2.7.3 (but not 2.7.2, released 4 months after 3.2.0).
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list