Commit graph

44 commits

Author SHA1 Message Date
Edward Loper
b3666a3da2 - Updated docs to reflect changes in 2.4.
- Reorganized the documentation
  - Shifted focus a little more towards "literate testing"
  - Documented new functions and classes:
    - testfile()
    - Example, DocTest
    - DocTestParser, DocTestFinder, DocTestRunner, OutputChecker
    - DocFileSuite
    - DebugRunner, DocTestFailure, UnexpectedException
    - register_optionflag()
2004-09-21 03:00:51 +00:00
Edward Loper
6cc1350807 - Updated example output to match actual output
- Minor wording changes
- Changed the docs to reflect the fact that multiple option directives
  can be specified on a single line (and updated the directive
  production list, as well).
2004-09-19 01:16:44 +00:00
Tim Peters
8278860e52 Document testmod's new exclude_empty argument. 2004-09-13 15:03:17 +00:00
Tim Peters
1fbf9c5ec1 Added IGNORE_EXCEPTION_DETAIL comparison option. The need is explained
in the new docs.

DocTestRunner.__run:  Separate the determination of the example outcome
from reporting that outcome, to squash brittle code duplication and
excessive nesting.
2004-09-04 17:21:02 +00:00
Tim Peters
38330fe5ef The distinction between comparison flags and reporting flags isn't unique
to unittest, so make it official:  new module constants COMPARISON_FLAGS
and REPORTING_FLAGS, which are bitmasks or'ing together the relevant
individual option flags.

set_unittest_reportflags():  Reworked to use REPORTING_FLAGS, and
simplified overly complicated flag logic.

class FakeModule:  Removed this; neither documented nor used.
2004-08-30 16:19:24 +00:00
Tim Peters
f33683fd40 Fine tune a word. 2004-08-26 04:52:46 +00:00
Tim Peters
cf53355fcf Thinko repair. 2004-08-26 04:50:38 +00:00
Tim Peters
a07bcd46f3 Reorg of exception section. Now that there are fewer details needing
explanation, it's easier to push the remaining insufferably anal details
into a "fine print" section at the bottom.
2004-08-26 04:47:31 +00:00
Edward Loper
a89f88d53f Added REPORT_ONLY_FIRST_FAILURE flag, which supresses output after the
first failing example in each test.
2004-08-26 02:45:51 +00:00
Edward Loper
71f55af826 Renamed UNIFIED_DIFF->REPORT_UDIFF; CONTEXT_DIFF->REPORT_CDIFF; and
NDIFF_DIFF->REPORT_NDIFF.  This establishes the naming convention that
all reporting options should begin with "REPORT_" (since reporting
options are a different class from output comparison options; but they
are both set in optionflags).
2004-08-26 01:41:51 +00:00
Tim Peters
0e448073d6 Restored half of a \versionadded only half of which should have been
deleted.
2004-08-26 01:02:08 +00:00
Edward Loper
19b1958730 Only recognize the expected output as an exception if it *starts* with
a traceback message.  I.e., examples that raise exceptions may no
longer generate pre-exception output.  This restores the behavior of
doctest in python 2.3.  The ability to check pre-exception output is
being removed because it makes the documentation simpler; and because
there are very few use cases for it.
2004-08-25 23:07:03 +00:00
Tim Peters
656f7e4b40 Removed redundant versionadded{} for NDIFF_DIFF. Virtually everything
in this section is new in 2.4, and that's all mentioned already in
versionadded{} thingies at the end of the section.  It hurts readability
to have them after every line <wink>.
2004-08-23 00:26:42 +00:00
Neal Norwitz
8bd5cb342c Add version info 2004-08-22 21:48:37 +00:00
Tim Peters
c6cbab0db4 Added NDIFF_DIFF option. 2004-08-22 19:43:28 +00:00
Johannes Gijsbers
c89061817b Quote # as \# to make lib compile again. 2004-08-20 14:37:05 +00:00
Tim Peters
026f8dc103 Now that they've settled down, document doctest directives. 2004-08-19 16:38:58 +00:00
Tim Peters
83e259a2c2 Another microburst of snail-like progress. 2004-08-13 21:55:21 +00:00
Tim Peters
41a65ea7fe Doctest has new traceback gimmicks in 2.4. While trying to document
them (which they are now), I had to rewrite the code to understand
it.  This has got to be the most DWIM part of doctest -- but in context
is really necessary.
2004-08-13 03:55:05 +00:00
Tim Peters
2603960525 Markup fiddling. 2004-08-13 01:49:12 +00:00
Tim Peters
8a3b69ca8f Excruciatingly slow progress on the docs. Option flags / directive names
are documented now, and ripped out a bunch of "private name" convolutions.
2004-08-12 22:31:25 +00:00
Fred Drake
9d92d5a9ac minor changes to make this format again 2004-08-10 15:41:03 +00:00
Tim Peters
c2388a2b9c Start rewriting doctest's LaTeX docs. Damn, this is slow going! 2004-08-10 01:41:28 +00:00
Tim Peters
336689b9cc A few trivial edits. 2004-07-23 02:48:24 +00:00
Martin v. Löwis
92816de18e Patch #932930: suggest the use of rawstrings for backslashes. 2004-05-31 19:01:00 +00:00
Martin v. Löwis
ccabed35ee Patch #849350: Update to document bool return values. Backported to 2.3. 2003-11-27 19:48:03 +00:00
Raymond Hettinger
f17d65da3a SF patch#786531 'the the' typo. Contributed by George Yoshida 2003-08-12 00:01:16 +00:00
Fred Drake
7a6b4f0284 more markup chages 2003-07-17 16:00:01 +00:00
Fred Drake
8836e567b9 - remove mention of the isprivate flag, since that isn't directly
documented here, and according to Tim, should never have been there
- misc. cleanups for consistency
2003-07-17 15:22:47 +00:00
Raymond Hettinger
943277ecd3 Minor corrections. 2003-07-17 14:47:12 +00:00
Raymond Hettinger
71adf7e9d8 Doctest now examines all docstrings by default. Previously, it would
skip over functions with private names (as indicated by the underscore
naming convention).  The old default created too much of a risk that
user tests were being skipped inadvertently.  Note, this change could
break code in the unlikely case that someone had intentionally put
failing tests in the docstrings of private functions.  The breakage
is easily fixable by specifying the old behavior when calling testmod()
or Tester().  The more likely case is that the silent failure was
unintended and that the user needed to be informed so the test could be
fixed.
2003-07-16 19:25:22 +00:00
Raymond Hettinger
92f21b13ea Document Jim Fulton's docttest extensions. 2003-07-11 22:32:18 +00:00
Fred Drake
5d2f515dd4 fix markup nits 2003-06-28 03:09:06 +00:00
Tim Peters
6ebe61fa80 A hack to ease compatibility with pre-2.3 Pythons: by default, doctest
now accepts "True" when a test expects "1", and similarly for "False"
versus "0".  This is un-doctest-like, but on balance makes it much
more pleasant to write doctests that pass under 2.2 and 2.3.  I expect
it to go away again, when 2.2 is forgotten.  In the meantime, there's
a new doctest module constant that can be passed to a new optional
argument, if you want to turn this behavior off.

Note that this substitution is very simple-minded:  the expected and
actual outputs have to consist of single tokens.  No attempt is made,
e.g., to accept [True, False] when a test expects [1, 0].  This is a
simple hack for simple tests, and I intend to keep it that way.
2003-06-27 20:48:05 +00:00
Martin v. Löwis
4581cfa326 Patch #486438: Make module argument to testmod optional. 2002-11-22 08:23:09 +00:00
Tim Peters
0481d24dd5 CVS patch [#466628] Doc changes for doctest patch (#466616), from
Tim Hochberg.  Doctest no longer searches imported objects.
2001-10-02 21:01:22 +00:00
Fred Drake
c115835457 Fix recent changes so that this section will format again. 2001-06-11 14:55:01 +00:00
Skip Montanaro
1dc98c44fe add warning about situation where code may be executed twice, once when
module is __main__ and once when module is imported.
2001-06-08 14:40:28 +00:00
Fred Drake
4cf1227e56 Change {\em ...} to \emph{...} for consistency with the rest of the Python
documentation.
2001-04-05 18:31:27 +00:00
Fred Drake
19f3c52347 Work around the broken formatting of sys.ps1 prompts in running text.
Move sample sessions to the left margin of the file for consistency;
formatting can adjust the margin if needed.

This closes SF bug #133213.
2001-02-22 23:15:05 +00:00
Tim Peters
f0768c822b Added missing \item. See also bug 133213, about damaged HTML generated
for \code(">>>"); don't know how to fix that one.
2001-02-20 10:57:30 +00:00
Tim Peters
c4089d84d8 In the example showing the irrelevance of start columns, restore that the
start columns differ (editing had pushed them all into column 0).
2001-02-17 18:03:25 +00:00
Fred Drake
7eb1463bb3 Make a variety of minor markup adjustments.
Close some environments so that this will actually format.
2001-02-17 17:32:41 +00:00
Tim Peters
7688229f7c SF patch #103808: doctest.py docs
Checking in Moshe's patch after rewrapping some paragraphs (to consume
fewer columns) and repairing that I/2.**J lost the I.
2001-02-17 05:58:44 +00:00