From 89437319a7c3fa67a8f04c3a59b3d23e303bae22 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Fri, 1 Jun 2018 15:09:14 -0700 Subject: [PATCH 1/2] fix type for TestCase.assertIn This does essentially `assert member in container`, so we want a `Container`, not an `Iterable`. This came up in https://github.com/ambv/black/pull/288/files/68e9d426a86edc187a3f58ea889a2002620f0de6..0bbee43d60dfc16d8bbdd0bbdaad754a2c8c7ec0#r192525658. --- stdlib/3/unittest/__init__.pyi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/stdlib/3/unittest/__init__.pyi b/stdlib/3/unittest/__init__.pyi index febc718830ca..55dffbaee2c8 100644 --- a/stdlib/3/unittest/__init__.pyi +++ b/stdlib/3/unittest/__init__.pyi @@ -1,9 +1,9 @@ # Stubs for unittest from typing import ( - Any, Callable, ContextManager, Dict, FrozenSet, Generic, Iterable, Iterator, - List, NoReturn, Optional, overload, Pattern, Sequence, Set, TextIO, Tuple, - Type, TypeVar, Union + Any, Callable, Container, ContextManager, Dict, FrozenSet, Generic, Iterable, + Iterator, List, NoReturn, Optional, overload, Pattern, Sequence, Set, TextIO, + Tuple, Type, TypeVar, Union ) import logging import sys @@ -50,9 +50,9 @@ class TestCase: msg: Any = ...) -> None: ... def assertIsNone(self, expr: Any, msg: Any = ...) -> None: ... def assertIsNotNone(self, expr: Any, msg: Any = ...) -> None: ... - def assertIn(self, first: _T, second: Iterable[_T], + def assertIn(self, member: _T, container: Container[_T], msg: Any = ...) -> None: ... - def assertNotIn(self, first: _T, second: Iterable[_T], + def assertNotIn(self, member: _T, container: Container[_T], msg: Any = ...) -> None: ... def assertIsInstance(self, obj: Any, cls: Union[type, Tuple[type, ...]], From d9e68cf24243bf964e59eca30a21eb3e2ffb4d63 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Fri, 1 Jun 2018 15:17:39 -0700 Subject: [PATCH 2/2] use any for assertIn --- stdlib/3/unittest/__init__.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/3/unittest/__init__.pyi b/stdlib/3/unittest/__init__.pyi index 55dffbaee2c8..f78a9a4bdec2 100644 --- a/stdlib/3/unittest/__init__.pyi +++ b/stdlib/3/unittest/__init__.pyi @@ -50,9 +50,9 @@ class TestCase: msg: Any = ...) -> None: ... def assertIsNone(self, expr: Any, msg: Any = ...) -> None: ... def assertIsNotNone(self, expr: Any, msg: Any = ...) -> None: ... - def assertIn(self, member: _T, container: Container[_T], + def assertIn(self, member: Any, container: Container[Any], msg: Any = ...) -> None: ... - def assertNotIn(self, member: _T, container: Container[_T], + def assertNotIn(self, member: Any, container: Container[Any], msg: Any = ...) -> None: ... def assertIsInstance(self, obj: Any, cls: Union[type, Tuple[type, ...]],