New submission from Chris Jerdonek: When newlines are present, the error message displayed by unittest's self.assertEqual() to show where strings differ can be nonsensical. For example, the caret symbol can show up in a strange location.
The first example below shows a case where things work correctly. The second shows a newline case with the confusing display. ====================================================================== FAIL: test1 ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/chris/***/test.py", line 66, in test1 self.assertEqual("abc", "abd") AssertionError: 'abc' != 'abd' - abc ? ^ + abd ? ^ ====================================================================== FAIL: test2 ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/chris/***/test.py", line 69, in test2 self.assertEqual("\nabcx", "\nabdx") AssertionError: '\nabcx' != '\nabdx' - abcx? ^ + abdx? ^ ---------- components: Library (Lib) messages: 247883 nosy: chris.jerdonek priority: normal severity: normal status: open title: unittest assertEqual difference output foiled by newlines type: behavior versions: Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue24780> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com