diff options
author | Michael Foord <fuzzyman@voidspace.org.uk> | 2010-06-05 13:49:56 (GMT) |
---|---|---|
committer | Michael Foord <fuzzyman@voidspace.org.uk> | 2010-06-05 13:49:56 (GMT) |
commit | 9dad32efe8e63cda4de3b53004598d2c1f6aa129 (patch) | |
tree | cb3451a04582c2350a0290d155e82170f158cb9c | |
parent | 5d0c81f3b386aac8d490541970379d25b44c4f70 (diff) | |
download | cpython-9dad32efe8e63cda4de3b53004598d2c1f6aa129.zip cpython-9dad32efe8e63cda4de3b53004598d2c1f6aa129.tar.gz cpython-9dad32efe8e63cda4de3b53004598d2c1f6aa129.tar.bz2 |
Merged revisions 81752 via svnmerge from
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.
........
-rw-r--r-- | Lib/unittest/case.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py index fca7e19..fcb756d 100644 --- a/Lib/unittest/case.py +++ b/Lib/unittest/case.py @@ -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. |