[Python-checkins] python/dist/src/Lib doctest.py,1.88,1.89
edloper at users.sourceforge.net
edloper at users.sourceforge.net
Thu Aug 26 05:00:34 CEST 2004
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31499/dist/src/Lib
Modified Files:
doctest.py
Log Message:
Changed OutputChecker.output_difference to expect an Example object,
rather than an expected output string. This gives the
output_difference method access to more information, such as the
indentation of the example, which might be useful.
Index: doctest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/doctest.py,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- doctest.py 26 Aug 2004 02:45:50 -0000 1.88
+++ doctest.py 26 Aug 2004 03:00:24 -0000 1.89
@@ -1282,8 +1282,7 @@
Report that the given example failed.
"""
out(self._failure_header(test, example) +
- self._checker.output_difference(example.want, got,
- self.optionflags))
+ self._checker.output_difference(example, got, self.optionflags))
def report_unexpected_exception(self, out, test, example, exc_info):
"""
@@ -1608,13 +1607,14 @@
# The other diff types need at least a few lines to be helpful.
return want.count('\n') > 2 and got.count('\n') > 2
- def output_difference(self, want, got, optionflags):
+ def output_difference(self, example, got, optionflags):
"""
Return a string describing the differences between the
- expected output for an example (`want`) and the actual output
- (`got`). `optionflags` is the set of option flags used to
- compare `want` and `got`.
+ expected output for a given example (`example`) and the actual
+ output (`got`). `optionflags` is the set of option flags used
+ to compare `want` and `got`.
"""
+ want = example.want
# If <BLANKLINE>s are being used, then replace blank lines
# with <BLANKLINE> in the actual output string.
if not (optionflags & DONT_ACCEPT_BLANKLINE):
More information about the Python-checkins
mailing list