diff options
author | Pierre-Yves David <pierre-yves.david@logilab.fr> | 2010-11-22 17:12:45 +0100 |
---|---|---|
committer | Pierre-Yves David <pierre-yves.david@logilab.fr> | 2010-11-22 17:12:45 +0100 |
commit | 78931f28aa2593011d9048a0edd8381785bbabfd (patch) | |
tree | aa4b25d341a19150b4bfb92218ecbfabccece0c7 /testlib.py | |
parent | 48540947f58122096757482dbac9695278f11bb2 (diff) | |
download | logilab-common-78931f28aa2593011d9048a0edd8381785bbabfd.tar.gz |
[testlib ]add a context argument to assertDictEquals to ease extension
Diffstat (limited to 'testlib.py')
-rw-r--r-- | testlib.py | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -786,7 +786,7 @@ succeeded test into", osp.join(os.getcwd(), FILE_RESTART) raise InnerTestSkipped(msg) @deprecated('Please use assertDictEqual instead.') - def assertDictEquals(self, dict1, dict2, msg=None): + def assertDictEquals(self, dict1, dict2, msg=None, context=None): """compares two dicts If the two dict differ, the first difference is shown in the error @@ -810,7 +810,11 @@ succeeded test into", osp.join(os.getcwd(), FILE_RESTART) if msg: self.failureException(msg) elif msgs: - self.fail('\n'.join(msgs)) + if context is not None: + base = '%s\n' % context + else: + base = '' + self.fail(base + '\n'.join(msgs)) @deprecated('Please use assertItemsEqual instead.') def assertUnorderedIterableEquals(self, got, expected, msg=None): |