Ezio Melotti added the comment:

The assertSequenceEqual docs[0] say:
"""
This method is not called directly by assertEqual(), but it’s used to implement 
assertListEqual() and assertTupleEqual().
"""

The asserEqual docs[1] say:
"""
In addition, if first and second are the exact same type and one of list, 
tuple, dict, set, frozenset or str or any type that a subclass registers with 
addTypeEqualityFunc() the type-specific equality function will be called in 
order to generate a more useful default error message (see also the list of 
type-specific methods).
"""

assertEqual[2] calls _getAssertEqualityFunc[3] that checks if type(first) is 
type(second), so in your case no specific assert function is called, and since 
you are not comparing objects of the same type, you are not able to use 
addTypeEqualityFunc() either.

I think in this case using assertSequenceEqual() directly is ok.

[0]: 
http://docs.python.org/py3k/library/unittest.html#unittest.TestCase.assertSequenceEqual
[1]: 
http://docs.python.org/py3k/library/unittest.html#unittest.TestCase.assertEqual
[2]: http://hg.python.org/cpython/file/124fb2b39ed9/Lib/unittest/case.py#l637
[3]: http://hg.python.org/cpython/file/124fb2b39ed9/Lib/unittest/case.py#l604

----------
nosy: +ezio.melotti

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

Reply via email to