[New-bugs-announce] [issue24780] unittest assertEqual difference output foiled by newlines
Chris Jerdonek
report at bugs.python.org
Sun Aug 2 18:49:29 CEST 2015
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 <report at bugs.python.org>
<http://bugs.python.org/issue24780>
_______________________________________
More information about the New-bugs-announce
mailing list