summaryrefslogtreecommitdiffstats
path: root/Lib/doctest.py
diff options
context:
space:
mode:
authorEdward Loper <edloper@gradient.cis.upenn.edu>2004-08-26 01:31:56 (GMT)
committerEdward Loper <edloper@gradient.cis.upenn.edu>2004-08-26 01:31:56 (GMT)
commit5662929a4268efdeed21c45366e6a632926a275f (patch)
tree70a06f63712264aea8f541c7216dc08b6372aa70 /Lib/doctest.py
parentaacf0833886c30f900fe18db1367d887cc0d1172 (diff)
downloadcpython-5662929a4268efdeed21c45366e6a632926a275f.zip
cpython-5662929a4268efdeed21c45366e6a632926a275f.tar.gz
cpython-5662929a4268efdeed21c45366e6a632926a275f.tar.bz2
Shortened diff output for unified & context diffs
Diffstat (limited to 'Lib/doctest.py')
-rw-r--r--Lib/doctest.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/doctest.py b/Lib/doctest.py
index dfa1848..9a88b7a 100644
--- a/Lib/doctest.py
+++ b/Lib/doctest.py
@@ -1618,13 +1618,13 @@ class OutputChecker:
got_lines = [l+'\n' for l in got.split('\n')]
# Use difflib to find their differences.
if optionflags & UNIFIED_DIFF:
- diff = difflib.unified_diff(want_lines, got_lines, n=2,
- fromfile='Expected', tofile='Got')
- kind = 'unified diff'
+ diff = difflib.unified_diff(want_lines, got_lines, n=2)
+ diff = list(diff)[2:] # strip the diff header
+ kind = 'unified diff with -expected +actual'
elif optionflags & CONTEXT_DIFF:
- diff = difflib.context_diff(want_lines, got_lines, n=2,
- fromfile='Expected', tofile='Got')
- kind = 'context diff'
+ diff = difflib.context_diff(want_lines, got_lines, n=2)
+ diff = list(diff)[2:] # strip the diff header
+ kind = 'context diff with expected followed by actual'
elif optionflags & NDIFF_DIFF:
engine = difflib.Differ(charjunk=difflib.IS_CHARACTER_JUNK)
diff = list(engine.compare(want_lines, got_lines))