[Python-checkins] r81752 - python/trunk/Lib/unittest/case.py
michael.foord
python-checkins at python.org
Sat Jun 5 15:38:17 CEST 2010
Author: michael.foord
Date: Sat Jun 5 15:38:16 2010
New Revision: 81752
Log:
unittest.TestCase assertion methods inform you when they have omitted an over long diff on failure. Issue 8351.
Modified:
python/trunk/Lib/unittest/case.py
Modified: python/trunk/Lib/unittest/case.py
==============================================================================
--- python/trunk/Lib/unittest/case.py (original)
+++ python/trunk/Lib/unittest/case.py Sat Jun 5 15:38:16 2010
@@ -14,6 +14,10 @@
__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 @@
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.
More information about the Python-checkins
mailing list