From cf691935bb1a59bd7ff680b26b0b0040b7e25449 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 21 Sep 2001 21:06:22 +0000 Subject: reportdiff(): print a "plain diff" style diff. XXX This should really be a unified diff, but I can't be bothered. --- Lib/test/regrtest.py | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index c8c9167..79ee3b1 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -351,10 +351,36 @@ def runtest(test, generate, verbose, quiet, testdir = None): def reportdiff(expected, output): print "*" * 70 import difflib - a = expected.splitlines(1) - b = output.splitlines(1) - diff = difflib.ndiff(a, b) - print ''.join(diff), + a = expected.splitlines() + b = output.splitlines() + sm = difflib.SequenceMatcher(a=a, b=b) + tuples = sm.get_opcodes() + def pair(x0, x1): + x0 += 1 + if x0 >= x1: + return str(x0) + else: + return "%d,%d" % (x0, x1) + for op, a0, a1, b0, b1 in tuples: + if op == 'equal': + pass + elif op == 'delete': + print pair(a0, a1) + "d" + pair(b0, b1) + for line in a[a0:a1]: + print "<", line + elif op == 'replace': + print pair(a0, a1) + "c" + pair(b0, b1) + for line in a[a0:a1]: + print "<", line + print "---" + for line in b[b0:b1]: + print ">", line + elif op == 'insert': + print str(a0) + "a" + pair(b0, b1) + for line in b[b0:b1]: + print ">", line + else: + print "get_opcodes() returned bad tuple?!?!", (op, a0, a1, b0, b1) print "*" * 70 def findtestdir(): -- cgit v0.12 '>treecommitdiffstats
path: root/Lib/copy.py
Commit message (Expand)AuthorAgeFilesLines
* Issue #20289: The copy module now uses pickle protocol 4 (PEP 3154) andSerhiy Storchaka2015-03-241-2/+2
* improve idioms (closes #20642)Benjamin Peterson2014-05-041-5/+3
* Issue #20791: copy.copy() now doesn't make a copy when the input is a bytes o...Antoine Pitrou2014-02-271-1/+1
* Issue #11480: Fixed copy.copy to work with classes with custom metaclasses.Alexandre Vassalotti2013-12-011-0/+8
* #11572: improvements to copy module tests along with removal of old test suiteSandro Tosi2011-08-051-65/+0
* don't memoize objects that are their own copies (closes #12422)Benjamin Peterson2011-06-271-5/+7
* Fix running the copy module from the command-line (however use{ful,less} it m...Antoine Pitrou2010-09-041-1/+2
* Issue #1100562: Fix deep-copying of objects derived from the list and dict ty...Antoine Pitrou2010-09-041-11/+23
* Merged revisions 76571 via svnmerge fromAntoine Pitrou2009-11-281-0/+4
* Merged revisions 72669 via svnmerge fromAntoine Pitrou2009-05-151-1/+3
* Rename the repr module to reprlib.Alexandre Vassalotti2008-05-161-10/+9
* Rename copy_reg module to copyreg.Alexandre Vassalotti2008-05-111-1/+1
* Merged revisions 61834,61841-61842,61851-61853,61863-61864,61869-61870,61874,...Christian Heimes2008-03-251-1/+2
* Merging the py3k-pep3137 branch back into the py3k branch.Guido van Rossum2007-11-061-1/+1
* Merged revisions 55795-55816 via svnmerge fromGuido van Rossum2007-06-071-4/+6
* Register a dispatcher for str8. (This makes test_copy.py pass again.)Walter Dörwald2007-06-071-4/+1
* Merged revisions 55007-55179 via svnmerge fromGuido van Rossum2007-05-071-2/+2
* Rip out all the u"..." literals and calls to unicode().Guido van Rossum2007-05-021-1/+1
* Remove duplicate refs to int from int/long unification presumably. (There mi...Neal Norwitz2007-02-271-2/+1
* - PEP 3106: dict.iterkeys(), .iteritems(), .itervalues() are now gone;Guido van Rossum2007-02-111-3/+3
* Fix most trivially-findable print statements.Guido van Rossum2007-02-09