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 ezio.melotti
Recipients ezio.melotti, flox, michael.foord, r.david.murray
Date 2012-08-29.13:57:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1346248621.56.0.291293045327.issue15810@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2012-08-29 13:57:01ezio.melottisetrecipients: + ezio.melotti, r.david.murray, michael.foord, flox
2012-08-29 13:57:01ezio.melottisetmessageid: <1346248621.56.0.291293045327.issue15810@psf.upfronthosting.co.za>
2012-08-29 13:57:01ezio.melottilinkissue15810 messages
2012-08-29 13:57:00ezio.melotticreate