Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7a6b4f0

Browse files
committed
more markup chages
1 parent 032fffe commit 7a6b4f0

1 file changed

Lines changed: 38 additions & 33 deletions

File tree

Doc/lib/libdoctest.tex

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,18 @@ \section{\module{doctest} ---
8585
_test()
8686
\end{verbatim}
8787

88-
If you run \file{example.py} directly from the command line, doctest works
89-
its magic:
88+
If you run \file{example.py} directly from the command line,
89+
\module{doctest} works its magic:
9090

9191
\begin{verbatim}
9292
$ python example.py
9393
$
9494
\end{verbatim}
9595

96-
There's no output! That's normal, and it means all the examples worked.
97-
Pass \programopt{-v} to the script, and doctest prints a detailed log
98-
of what it's trying, and prints a summary at the end:
96+
There's no output! That's normal, and it means all the examples
97+
worked. Pass \programopt{-v} to the script, and \module{doctest}
98+
prints a detailed log of what it's trying, and prints a summary at the
99+
end:
99100

100101
\begin{verbatim}
101102
$ python example.py -v
@@ -135,9 +136,10 @@ \section{\module{doctest} ---
135136
$
136137
\end{verbatim}
137138

138-
That's all you need to know to start making productive use of doctest! Jump
139-
in. The docstrings in doctest.py contain detailed information about all
140-
aspects of doctest, and we'll just cover the more important points here.
139+
That's all you need to know to start making productive use of
140+
\module{doctest}! Jump in. The docstrings in \file{doctest.py} contain
141+
detailed information about all aspects of \module{doctest}, and we'll
142+
just cover the more important points here.
141143

142144
\subsection{Normal Usage}
143145

@@ -285,8 +287,8 @@ \subsection{Advanced Usage}
285287
\end{funcdesc}
286288

287289
\begin{funcdesc}{DocTestSuite}{\optional{module}}
288-
Convert doctest tests for a module to a \refmodule{unittest}
289-
\class{TestSuite}.
290+
Convert doctest tests for a module to a
291+
\class{\refmodule{unittest}.TestSuite}.
290292

291293
The returned \class{TestSuite} is to be run by the unittest framework
292294
and runs each doctest in the module. If any of the doctests fail,
@@ -320,10 +322,11 @@ \subsection{Advanced Usage}
320322

321323
\subsection{How are Docstring Examples Recognized?}
322324

323-
In most cases a copy-and-paste of an interactive console session works fine
324-
--- just make sure the leading whitespace is rigidly consistent (you can mix
325-
tabs and spaces if you're too lazy to do it right, but doctest is not in
326-
the business of guessing what you think a tab means).
325+
In most cases a copy-and-paste of an interactive console session works
326+
fine---just make sure the leading whitespace is rigidly consistent
327+
(you can mix tabs and spaces if you're too lazy to do it right, but
328+
\module{doctest} is not in the business of guessing what you think a tab
329+
means).
327330

328331
\begin{verbatim}
329332
>>> # comments are ignored
@@ -486,25 +489,27 @@ \subsection{Warnings}
486489

487490
\subsection{Soapbox}
488491

489-
The first word in doctest is "doc", and that's why the author wrote
490-
doctest: to keep documentation up to date. It so happens that doctest
491-
makes a pleasant unit testing environment, but that's not its primary
492-
purpose.
493-
494-
Choose docstring examples with care. There's an art to this that needs to
495-
be learned --- it may not be natural at first. Examples should add genuine
496-
value to the documentation. A good example can often be worth many words.
497-
If possible, show just a few normal cases, show endcases, show interesting
498-
subtle cases, and show an example of each kind of exception that can be
499-
raised. You're probably testing for endcases and subtle cases anyway in an
500-
interactive shell: doctest wants to make it as easy as possible to capture
501-
those sessions, and will verify they continue to work as designed forever
502-
after.
503-
504-
If done with care, the examples will be invaluable for your users, and will
505-
pay back the time it takes to collect them many times over as the years go
506-
by and "things change". I'm still amazed at how often one of my doctest
507-
examples stops working after a "harmless" change.
492+
The first word in ``doctest'' is ``doc,'' and that's why the author
493+
wrote \refmodule{doctest}: to keep documentation up to date. It so
494+
happens that \refmodule{doctest} makes a pleasant unit testing
495+
environment, but that's not its primary purpose.
496+
497+
Choose docstring examples with care. There's an art to this that
498+
needs to be learned---it may not be natural at first. Examples should
499+
add genuine value to the documentation. A good example can often be
500+
worth many words. If possible, show just a few normal cases, show
501+
endcases, show interesting subtle cases, and show an example of each
502+
kind of exception that can be raised. You're probably testing for
503+
endcases and subtle cases anyway in an interactive shell:
504+
\refmodule{doctest} wants to make it as easy as possible to capture
505+
those sessions, and will verify they continue to work as designed
506+
forever after.
507+
508+
If done with care, the examples will be invaluable for your users, and
509+
will pay back the time it takes to collect them many times over as the
510+
years go by and things change. I'm still amazed at how often one of
511+
my \refmodule{doctest} examples stops working after a ``harmless''
512+
change.
508513

509514
For exhaustive testing, or testing boring cases that add no value to the
510515
docs, define a \code{__test__} dict instead. That's what it's for.

0 commit comments

Comments
 (0)