Message226193
| 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:54 | TonyFlury | set | recipients:
+ TonyFlury, docs@python |
| 2014年08月31日 21:55:54 | TonyFlury | set | messageid: <1409522154.37.0.82658213186.issue22318@psf.upfronthosting.co.za> |
| 2014年08月31日 21:55:54 | TonyFlury | link | issue22318 messages |
| 2014年08月31日 21:55:54 | TonyFlury | create |
|