Skip to content

Commit eef0b1d

Browse files
JelleZijlstraambv
authored andcommitted
fix type for TestCase.assertIn (#2186)
* 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. * use any for assertIn
1 parent 9ec6d47 commit eef0b1d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

stdlib/3/unittest/__init__.pyi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Stubs for unittest
22

33
from typing import (
4-
Any, Callable, ContextManager, Dict, FrozenSet, Generic, Iterable, Iterator,
5-
List, NoReturn, Optional, overload, Pattern, Sequence, Set, TextIO, Tuple,
6-
Type, TypeVar, Union
4+
Any, Callable, Container, ContextManager, Dict, FrozenSet, Generic, Iterable,
5+
Iterator, List, NoReturn, Optional, overload, Pattern, Sequence, Set, TextIO,
6+
Tuple, Type, TypeVar, Union
77
)
88
import logging
99
import sys
@@ -50,9 +50,9 @@ class TestCase:
5050
msg: Any = ...) -> None: ...
5151
def assertIsNone(self, expr: Any, msg: Any = ...) -> None: ...
5252
def assertIsNotNone(self, expr: Any, msg: Any = ...) -> None: ...
53-
def assertIn(self, first: _T, second: Iterable[_T],
53+
def assertIn(self, member: Any, container: Container[Any],
5454
msg: Any = ...) -> None: ...
55-
def assertNotIn(self, first: _T, second: Iterable[_T],
55+
def assertNotIn(self, member: Any, container: Container[Any],
5656
msg: Any = ...) -> None: ...
5757
def assertIsInstance(self, obj: Any,
5858
cls: Union[type, Tuple[type, ...]],

0 commit comments

Comments
 (0)