Commit 2839985c authored by Gregory P. Smith's avatar Gregory P. Smith

The unittest.TestCase.assertEqual() now displays the differences in lists,

tuples, dicts and sets on failure.

Many new handy type and comparison specific assert* methods have been added
that fail with error messages actually useful for debugging.  Contributed in
by Google and completed with help from mfoord and GvR at PyCon 2009 sprints.

Discussion lives in http://bugs.python.org/issue2578.
parent c2784229
This diff is collapsed.
......@@ -244,7 +244,7 @@ class GCTests(unittest.TestCase):
# - the call to assertEqual somehow avoids building its args tuple
def test_get_count(self):
# Avoid future allocation of method object
assertEqual = self.assertEqual
assertEqual = self._baseAssertEqual
gc.collect()
assertEqual(gc.get_count(), (0, 0, 0))
a = dict()
......
......@@ -227,6 +227,7 @@ class StructTest(unittest.TestCase):
BUGGY_RANGE_CHECK = "bBhHiIlL"
def __init__(self, formatpair, bytesize):
super(IntTester, self).__init__(methodName='test_one')
self.assertEqual(len(formatpair), 2)
self.formatpair = formatpair
for direction in "<>!=":
......
This diff is collapsed.
This diff is collapsed.
......@@ -217,6 +217,15 @@ Library
- Issue #1034053: unittest now supports skipping tests and expected failures.
- The unittest.TestCase.assertRaises() method now returns a context manager when
not given a callable so that code to be tested can be written inline using
a with statement.
- The unittest.TestCase.assertEqual() now displays the differences in lists,
tuples, dicts and sets on failure. Many new handy type and comparison
specific assert* methods have been added that fail with error messages
actually useful for debugging. Contributed in part by Google. [Issue #2578]
- Issue #5068: Fixed the tarfile._BZ2Proxy.read() method that would loop
forever on incomplete input. That caused tarfile.open() to hang when used
with mode 'r' or 'r:bz2' and a fileobj argument that contained no data or
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment