This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author chris.jerdonek
Recipients chris.jerdonek
Date 2015-08-02.16:49:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1438534169.3.0.814109265012.issue24780@psf.upfronthosting.co.za>
In-reply-to
Content
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?   ^
History
Date User Action Args
2015-08-02 16:49:29chris.jerdoneksetrecipients: + chris.jerdonek
2015-08-02 16:49:29chris.jerdoneksetmessageid: <1438534169.3.0.814109265012.issue24780@psf.upfronthosting.co.za>
2015-08-02 16:49:29chris.jerdoneklinkissue24780 messages
2015-08-02 16:49:29chris.jerdonekcreate