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):
try:
return unittest.TestCase.assertEqual(self, first, second, msg=msg)
except unittest.TestCase.failureException:
if (msg is None) and \
isinstance(first, list) and \
if isinstance(first, list) and \
isinstance(second, list):
msg = ''
err = ''
for elt in first:
if elt not in second:
msg += '- %s\n' % elt
err += '- %s\n' % elt
for elt in second:
if elt not in first:
msg += '+ %s\n' % elt
if msg == '':
err += '+ %s\n' % elt
if err == '':
raise
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
else:
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