[docs] [issue27060] Documentation of assertItemsEqual in unittest is VERY misleading in 2.7
Terry J. Reedy
report at bugs.python.org
Fri May 20 18:30:15 EDT 2016
Terry J. Reedy added the comment:
Note: 2.7 doc says that this is renamed assertCountEqual in 3.x. It was added in 2.7 and 3.2. The 3.x doc is essentially the same, but with this instead: "Equivalent to: assertEqual(Counter(list(first)), Counter(list(second))) ...".
If the method misfunctions, then it should be fixed, not have the bug documented. But you need to provide specific evidence and example. The unittest in 3.x has this test with same number, different elements.
self.assertRaises(self.failureException, self.assertCountEqual,
[1, 2] + [3] * 100, [1] * 100 + [2, 3])
I ran following test with same number, different items.
FAIL: test_Count (__main__.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
File "F:\Python\mypy\tem.py", line 4, in test_Count
self.assertItemsEqual([1,2,3], [1,2,4])
AssertionError: Element counts were not equal:
First has 1, Second has 0: 3
First has 0, Second has 1: 4
This also fails in 3.5 with name change.
----------
components: +Library (Lib) -Documentation
nosy: +terry.reedy
stage: -> test needed
type: -> behavior
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27060>
_______________________________________
More information about the docs
mailing list