[Python-checkins] python/dist/src/Lib doctest.py,1.85,1.86

edloper at users.sourceforge.net edloper at users.sourceforge.net
Thu Aug 26 03:31:59 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17857/dist/src/Lib

Modified Files:
	doctest.py 
Log Message:
Shortened diff output for unified & context diffs


Index: doctest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/doctest.py,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- doctest.py	26 Aug 2004 01:19:50 -0000	1.85
+++ doctest.py	26 Aug 2004 01:31:56 -0000	1.86
@@ -1618,13 +1618,13 @@
             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))



More information about the Python-checkins mailing list