summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Loper <edloper@gradient.cis.upenn.edu>2004-08-12 02:43:49 (GMT)
committerEdward Loper <edloper@gradient.cis.upenn.edu>2004-08-12 02:43:49 (GMT)
commit68ba9a685d2627efb8ffdb54296e9b9892924cc9 (patch)
treec7d76c1a46bad31fc445fbe9977ca8ffb85a3cc6
parenta5db6009fe195274760e0fb79aff67cb7f97e00e (diff)
downloadcpython-68ba9a685d2627efb8ffdb54296e9b9892924cc9.zip
cpython-68ba9a685d2627efb8ffdb54296e9b9892924cc9.tar.gz
cpython-68ba9a685d2627efb8ffdb54296e9b9892924cc9.tar.bz2
In output_difference(), replace blank lines in `want` with <BLANKLINE>
(rather than replacing <BLANKLINE> with blank lines in `got`). This makes it easier to see what's intended.
-rw-r--r--Lib/doctest.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/doctest.py b/Lib/doctest.py
index 9b91277..a98df1a 100644
--- a/Lib/doctest.py
+++ b/Lib/doctest.py
@@ -1492,10 +1492,10 @@ class OutputChecker:
compare `want` and `got`. `indent` is the indentation of the
original example.
"""
- # If <BLANKLINE>s are being used, then replace <BLANKLINE>
- # with blank lines in the expected output string.
+ # If <BLANKLINE>s are being used, then replace blank lines
+ # with <BLANKLINE> in the actual output string.
if not (optionflags & DONT_ACCEPT_BLANKLINE):
- want = re.sub('(?m)^%s$' % re.escape(BLANKLINE_MARKER), '', want)
+ got = re.sub('(?m)^[ ]*(?=\n)', BLANKLINE_MARKER, got)
# Check if we should use diff. Don't use diff if the actual
# or expected outputs are too short, or if the expected output