diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2010-04-26 21:07:40 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2010-04-26 21:07:40 -0400 |
commit | 3e4217569a648776e7d6a689f0ed5b3e87caccbe (patch) | |
tree | 13e16da9a838028098e7e8d7dfef57e3e13d32b3 /test/backunittest.py | |
parent | c96af2469f9bfc120e04284bb30df68ed356aa2d (diff) | |
download | python-coveragepy-git-3e4217569a648776e7d6a689f0ed5b3e87caccbe.tar.gz |
imported patch multiline-msg
Diffstat (limited to 'test/backunittest.py')
-rw-r--r-- | test/backunittest.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/test/backunittest.py b/test/backunittest.py index 3e521e5a..f606185f 100644 --- a/test/backunittest.py +++ b/test/backunittest.py @@ -73,7 +73,7 @@ class TestCase(unittest.TestCase): raise self.failureException("%r doesn't match %r" % (s, regex)) if _need('assertMultiLineEqual'): - def assertMultiLineEqual(self, first, second): + def assertMultiLineEqual(self, first, second, msg=None): """Assert that two multi-line strings are equal. If they aren't, show a nice diff. @@ -86,6 +86,8 @@ class TestCase(unittest.TestCase): 'Second argument is not a string') if first != second: - msg = ''.join(difflib.ndiff(first.splitlines(True), + message = ''.join(difflib.ndiff(first.splitlines(True), second.splitlines(True))) - self.fail("Multi-line strings are unequal:\n" + msg) + if msg: + message += " : " + msg + self.fail("Multi-line strings are unequal:\n" + message) |