Issue 932935: doctest: allow custom matchers for testing if got==want (original) (raw)

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:

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