mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #26462: Doc: reduce literal_block warnings, fix syntax highlighting.
Patch by Julien Palard.
This commit is contained in:
parent
87ec85f420
commit
1050d2d0c7
47 changed files with 329 additions and 128 deletions
|
@ -88,14 +88,18 @@ Here's a complete but small example module::
|
|||
doctest.testmod()
|
||||
|
||||
If you run :file:`example.py` directly from the command line, :mod:`doctest`
|
||||
works its magic::
|
||||
works its magic:
|
||||
|
||||
.. code-block:: shell-session
|
||||
|
||||
$ python example.py
|
||||
$
|
||||
|
||||
There's no output! That's normal, and it means all the examples worked. Pass
|
||||
``-v`` to the script, and :mod:`doctest` prints a detailed log of what
|
||||
it's trying, and prints a summary at the end::
|
||||
it's trying, and prints a summary at the end:
|
||||
|
||||
.. code-block:: shell-session
|
||||
|
||||
$ python example.py -v
|
||||
Trying:
|
||||
|
@ -109,7 +113,9 @@ it's trying, and prints a summary at the end::
|
|||
[1, 1, 2, 6, 24, 120]
|
||||
ok
|
||||
|
||||
And so on, eventually ending with::
|
||||
And so on, eventually ending with:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
Trying:
|
||||
factorial(1e100)
|
||||
|
@ -196,7 +202,9 @@ file. This can be done with the :func:`testfile` function::
|
|||
That short script executes and verifies any interactive Python examples
|
||||
contained in the file :file:`example.txt`. The file content is treated as if it
|
||||
were a single giant docstring; the file doesn't need to contain a Python
|
||||
program! For example, perhaps :file:`example.txt` contains this::
|
||||
program! For example, perhaps :file:`example.txt` contains this:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
The ``example`` module
|
||||
======================
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue