[New-bugs-announce] [issue25669] unittest.assertEqual() on un-equal types inheriting from collections.Mapping

Nathan Herring report at bugs.python.org
Thu Nov 19 09:59:24 EST 2015


New submission from Nathan Herring:

We have some code that generates objects that inherit from Mapping that are not nearly as straightforward to instantiate in a test. It's much easier to have something like the follows:

foo = … # some collections.Mapping subtype
self.assertEqual({'key': 'value'}, foo)

unittest/case.py's _baseAssertEqual will print out both sides and let me do visual inspection, but I'd prefer it if it knew both sides supported Mapping and in the != case, performed an analog of assertDictEqual so I could just get the keys/values that were mismatched, especially in the cases of large dictionaries.

----------
components: Tests
messages: 254902
nosy: Nathan Herring
priority: normal
severity: normal
status: open
title: unittest.assertEqual() on un-equal types inheriting from collections.Mapping
type: enhancement
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25669>
_______________________________________


More information about the New-bugs-announce mailing list