]> granicus.if.org Git - python/commitdiff
unittest.TestCase assertion methods inform you when they have omitted an over long...
authorMichael Foord <fuzzyman@voidspace.org.uk>
Sat, 5 Jun 2010 13:38:16 +0000 (13:38 +0000)
committerMichael Foord <fuzzyman@voidspace.org.uk>
Sat, 5 Jun 2010 13:38:16 +0000 (13:38 +0000)
Lib/unittest/case.py

index ff6b8b3cb961991b4ffbd1cc4105e86a549022f0..08e8c1e9640aab915b3f6c6e07cbdf75492d564b 100644 (file)
@@ -14,6 +14,10 @@ from .util import (
 
 __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.
@@ -700,7 +704,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.