New submission from Tony Flury: 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. ---------- assignee: docs@python components: Documentation messages: 226193 nosy: TonyFlury, docs@python priority: normal severity: normal status: open title: unitest documentation on assertItemsEqual misleading type: behavior versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22318> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com