This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author edloper
Recipients
Date 2004-04-10.19:57:49
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
To determine the success of a doctest example, 
doctest compares the
actual output to the expected output.  The test 
succeeds if the two
match exactly.

This patch gives the user the ability to supply a 
custom "matcher"
function, which will be used instead of string equality 
to test
whether the test succeeds.  This function should take 
two string
parameters, "got" and "want", which will contain the 
actual and
expected output, respectively; and it should return 
True if they
should be considered to match (i.e., test succeeds), 
and False if they
should not (i.e., test fails).

Two sample matcher functions are provided, as well:
  - match_ignoring_whitespace returns true if the 
actual output
    and expected output are equal, ignoring 
differences in amount
    of whitespace (eg 2 spaces vs 1).

  - match_ignoring_trailing_blanklines returns true if 
the actual
    output and expected output are equal, once any 
trailing blank
    lines are discarded.  This can be useful with the 
END_WITH_DEDENT
    option, suggested in patch #932933 [1]

The patch was made avainst revision 1.33 of 
doctest.py.

[1] http://sourceforge.net/tracker/index.php?
func=detail&aid=932933&group_id=5470&atid=3054
70
History
Date User Action Args
2007-08-23 15:37:06adminlinkissue932935 messages
2007-08-23 15:37:06admincreate