]> granicus.if.org Git - python/commitdiff
Merged revisions 81752 via svnmerge from
authorMichael Foord <fuzzyman@voidspace.org.uk>
Sat, 5 Jun 2010 13:49:56 +0000 (13:49 +0000)
committerMichael Foord <fuzzyman@voidspace.org.uk>
Sat, 5 Jun 2010 13:49:56 +0000 (13:49 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81752 | michael.foord | 2010-06-05 14:38:16 +0100 (Sat, 05 Jun 2010) | 1 line

  unittest.TestCase assertion methods inform you when they have omitted an over long diff on failure. Issue 8351.
........

Lib/unittest/case.py

index fca7e190d679def6677baa6308b7ff99640e33af..fcb756d3fbc9ddc9e936a4d65ff24833e1a78d2e 100644 (file)
@@ -13,6 +13,10 @@ from .util import (strclass, safe_repr, sorted_list_difference,
 
 __unittest = True
 
+
+DIFF_OMITTED = ('\nDiff is %s characters long. '
+                 'Set self.maxDiff to None to see it.')
+
 class SkipTest(Exception):
     """
     Raise this exception in a test to skip it.
@@ -711,7 +715,7 @@ class TestCase(object):
         max_diff = self.maxDiff
         if max_diff is None or len(diff) <= max_diff:
             return message + diff
-        return message
+        return message + (DIFF_OMITTED % len(diff))
 
     def assertListEqual(self, list1, list2, msg=None):
         """A list-specific equality assertion.