Michael Foord <mich...@voidspace.org.uk> added the comment:

assertEqual uses Python equality semantics - so if a str instance and a unicode 
instance compare equal then assertEqual passes. This is by design.

The type check in assertEqual, that delegates to the different comparison 
methods, is strict because we can't know that using the error message 
algorithms is sane for arbitrary subclasses - all we can know is whether an 
equality comparison fails or succeeds.

Using a diff algorithm for creating an error message only makes sense for text, 
which is why it is only done for unicode. For binary strings a diff is more 
likely to be unintelligible nonsense.  

For comparing unicode to strings you can call asssertMultilineEqual directly.

----------
resolution:  -> invalid
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14025>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to