diff options
author | Michael Foord <fuzzyman@voidspace.org.uk> | 2010-06-05 13:38:16 +0000 |
---|---|---|
committer | Michael Foord <fuzzyman@voidspace.org.uk> | 2010-06-05 13:38:16 +0000 |
commit | 5fe21ff91a0f3404680a7ff8c3c78b085b7ce92a (patch) | |
tree | 3de869246c5d37964edf1dec86a1a948887ef6d1 /Lib/unittest/case.py | |
parent | ec27d91741d93f3307208bb3faff590446eac0b7 (diff) | |
download | cpython-git-5fe21ff91a0f3404680a7ff8c3c78b085b7ce92a.tar.gz |
unittest.TestCase assertion methods inform you when they have omitted an over long diff on failure. Issue 8351.
Diffstat (limited to 'Lib/unittest/case.py')
-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 ff6b8b3cb9..08e8c1e964 100644 --- a/Lib/unittest/case.py +++ b/Lib/unittest/case.py @@ -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. |