Skip to content

Commit

Permalink
fix type for TestCase.assertIn (#2186)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
JelleZijlstra authored and ambv committed Jun 4, 2018
1 parent 9ec6d47 commit eef0b1d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions stdlib/3/unittest/__init__.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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: Any, container: Container[Any],
msg: Any = ...) -> None: ...
def assertNotIn(self, first: _T, second: Iterable[_T],
def assertNotIn(self, member: Any, container: Container[Any],
msg: Any = ...) -> None: ...
def assertIsInstance(self, obj: Any,
cls: Union[type, Tuple[type, ...]],
Expand Down

0 comments on commit eef0b1d

Please sign in to comment.