diff options
author | Edward Loper <edloper@gradient.cis.upenn.edu> | 2004-08-26 03:00:24 (GMT) |
---|---|---|
committer | Edward Loper <edloper@gradient.cis.upenn.edu> | 2004-08-26 03:00:24 (GMT) |
commit | ca9111eef31dc46077dfeffa1f17575dfde564d4 (patch) | |
tree | f75a012909af2bd3b43177dbb491e8f5f6cb2e15 /Lib/doctest.py | |
parent | a89f88d53fc83b3eb6788a6e70e0eb05a58703ed (diff) | |
download | cpython-ca9111eef31dc46077dfeffa1f17575dfde564d4.zip cpython-ca9111eef31dc46077dfeffa1f17575dfde564d4.tar.gz cpython-ca9111eef31dc46077dfeffa1f17575dfde564d4.tar.bz2 |
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.
Diffstat (limited to 'Lib/doctest.py')
-rw-r--r-- | Lib/doctest.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/doctest.py b/Lib/doctest.py index d7978fd..c01dd64 100644 --- a/Lib/doctest.py +++ b/Lib/doctest.py @@ -1282,8 +1282,7 @@ class DocTestRunner: 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 @@ class OutputChecker: # 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): |