Relax type of TestCase.assertCountEqual() params from Sequence to Iterable (#1006)

The stubs for `unittest.TestCase.assertCountEqual()` specify the parameters are Sequences; in fact the method works fine with Iterables, as the first thing the method does is convert them to lists.  [1]  The docs do say sequences, but it appears there is no reason they cannot be Iterables.

[1]: https://github.com/python/cpython/blob/master/Lib/unittest/case.py#L1156
This commit is contained in:
jkleint
2017-03-15 22:25:20 -07:00
committed by Łukasz Langa
parent a2fe3f4c59
commit 17be26165d

View File

@@ -117,7 +117,7 @@ class TestCase:
msg: Any = ...) -> None: ...
def assertNotRegex(self, text: str, regex: Union[str, Pattern[str]],
msg: Any = ...) -> None: ...
def assertCountEqual(self, first: Sequence[Any], second: Sequence[Any],
def assertCountEqual(self, first: Iterable[Any], second: Iterable[Any],
msg: Any = ...) -> None: ...
def addTypeEqualityFunc(self, typeobj: Type[Any],
function: Callable[..., None]) -> None: ...