mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
Match py2 assert*IsInstance with isinstance
The python2 unittest `assertIsInstance` and `assertNotIsInstance` stub did not allow using a tuple of classes, but that behavior is [in the documentation][1]. This commit copies the type stub for the isinstance built-in to the stubs for `assertIsInstance` and `assertNotIsInstance` I made this commit in response to @gvanrossum's request in python/typeshed#802 (which fixed this issue for python 3) that I apply the same fix to python 2. [1]: https://docs.python.org/2.7/library/unittest.html#unittest.TestCase.assertNotIsInstance
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
from typing import (
|
||||
Any, Callable, Dict, Iterable, Tuple, List, TextIO, Sequence,
|
||||
overload, Set, TypeVar, Pattern
|
||||
overload, Set, TypeVar, Union, Pattern
|
||||
)
|
||||
from abc import abstractmethod, ABCMeta
|
||||
|
||||
@@ -123,9 +123,9 @@ class TestCase(Testable):
|
||||
msg: object = ...) -> None: ...
|
||||
def assertNotIn(self, first: _T, second: Iterable[_T],
|
||||
msg: object = ...) -> None: ...
|
||||
def assertIsInstance(self, obj: Any, cls: type,
|
||||
def assertIsInstance(self, obj: Any, cls: Union[type, Tuple[type, ...]],
|
||||
msg: object = ...) -> None: ...
|
||||
def assertNotIsInstance(self, obj: Any, cls: type,
|
||||
def assertNotIsInstance(self, obj: Any, cls: Union[type, Tuple[type, ...]],
|
||||
msg: object = ...) -> None: ...
|
||||
def fail(self, msg: object = ...) -> None: ...
|
||||
def countTestCases(self) -> int: ...
|
||||
|
||||
Reference in New Issue
Block a user