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 TonyFlury
Recipients TonyFlury, docs@python
Date 2014-08-31.21:55:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1409522154.37.0.82658213186.issue22318@psf.upfronthosting.co.za>
In-reply-to
Content
The notes on assertItemsEqual do not make it clear that the comparison works by using their hash value, and not their __eq__ implementation - i.e. it does an 'is' not an '==' between objects in the sequence.

If the sequences being compared contain user created objects which don't implement their own specific __hash__ method (and therefore inherit their __hash__ from the base object - based on the object id), then the assertion will ALWAYS be false, regardless of their __eq__ value.

This only became clear when trying to use unitest, getting strange results, and I eventually read the code.
History
Date User Action Args
2014-08-31 21:55:54TonyFlurysetrecipients: + TonyFlury, docs@python
2014-08-31 21:55:54TonyFlurysetmessageid: <1409522154.37.0.82658213186.issue22318@psf.upfronthosting.co.za>
2014-08-31 21:55:54TonyFlurylinkissue22318 messages
2014-08-31 21:55:54TonyFlurycreate