Gregory P. Smith <g...@krypto.org> added the comment: Attaching a patch that adds Google's unittest.TestCase assertFooEqual() extensions and automatically uses rich comparisons in assertEqual() with nicely formatted failure messages for list, tuple, dict, set, frozenset.
The following are added by this patch: + def assertSequenceEqual(self, seq1, seq2, msg=None, seq_type=None): + def assertListEqual(self, list1, list2, msg=None): + def assertTupleEqual(self, tuple1, tuple2, msg=None): + def assertSetEqual(self, set1, set2, msg=None): + def assertIn(self, a, b, msg=None): + def assertNotIn(self, a, b, msg=None): + def assertDictEqual(self, d1, d2, msg=None): + def assertDictContainsSubset(self, expected, actual, msg=None): + def assertSameElements(self, expected_seq, actual_seq, msg=None): + def assertMultiLineEqual(self, first, second, msg=None): + def assertLess(self, a, b, msg=None): + def assertLessEqual(self, a, b, msg=None): + def assertGreater(self, a, b, msg=None): + def assertGreaterEqual(self, a, b, msg=None): + def assertIsNone(self, obj, msg=None): + def assertIsNotNone(self, obj, msg='unexpectedly None'): + def assertRaisesWithRegexpMatch(self, expected_exception, expected_regexp, As I said in the dev summit, I'll get some stats on how often each of these are used relative to others from a large code base which has had access to them for some time as an indicator of what may or may not be worth making standard. I did not include assertCommandSucceeds or assertCommandFails as those are more difficult to do the right thing for everyone on cross platform and our internal implementations use some other messy and not integration-worthy internal libraries at the moment. ---------- Added file: http://bugs.python.org/file13447/unittest-new-asserts-gps01.diff.txt _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue2578> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com