Doctest documentation?
Vincent Vande Vyvre
vincent.vandevyvre at swing.be
Sun May 20 12:33:51 EDT 2012
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]
--
Vincent V.V.
Oqapy <https://launchpad.net/oqapy> . Qarte+7
<https://launchpad.net/qarte+7> . PaQager <https://launchpad.net/paqager>
More information about the Python-list
mailing list