Commit c4a60129 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

display specified msg too.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40605 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 291b9f5e
...@@ -139,20 +139,22 @@ class AssertSoftwareMixin(unittest.TestCase): ...@@ -139,20 +139,22 @@ class AssertSoftwareMixin(unittest.TestCase):
try: try:
return unittest.TestCase.assertEqual(self, first, second, msg=msg) return unittest.TestCase.assertEqual(self, first, second, msg=msg)
except unittest.TestCase.failureException: except unittest.TestCase.failureException:
if (msg is None) and \ if isinstance(first, list) and \
isinstance(first, list) and \
isinstance(second, list): isinstance(second, list):
msg = '' err = ''
for elt in first: for elt in first:
if elt not in second: if elt not in second:
msg += '- %s\n' % elt err += '- %s\n' % elt
for elt in second: for elt in second:
if elt not in first: if elt not in first:
msg += '+ %s\n' % elt err += '+ %s\n' % elt
if msg == '': if err == '':
raise raise
else: else:
msg = 'Lists are different:\n%s' % msg if msg:
msg = '%s: Lists are different:\n%s' % (msg, err)
else:
msg = 'Lists are different:\n%s' % err
raise unittest.TestCase.failureException, msg raise unittest.TestCase.failureException, msg
else: else:
raise raise
......
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