summaryrefslogtreecommitdiff
path: root/testlib.py
diff options
context:
space:
mode:
authorPierre-Yves David <pierre-yves.david@logilab.fr>2010-11-22 17:12:45 +0100
committerPierre-Yves David <pierre-yves.david@logilab.fr>2010-11-22 17:12:45 +0100
commit78931f28aa2593011d9048a0edd8381785bbabfd (patch)
treeaa4b25d341a19150b4bfb92218ecbfabccece0c7 /testlib.py
parent48540947f58122096757482dbac9695278f11bb2 (diff)
downloadlogilab-common-78931f28aa2593011d9048a0edd8381785bbabfd.tar.gz
[testlib ]add a context argument to assertDictEquals to ease extension
Diffstat (limited to 'testlib.py')
-rw-r--r--testlib.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/testlib.py b/testlib.py
index 864dd92..8194733 100644
--- a/testlib.py
+++ b/testlib.py
@@ -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):