mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Fix TextTestResult and TextTestRunner in unittest (#2910)
Co-Authored-By: c-bata <c-bata@users.noreply.github.com>
This commit is contained in:
committed by
Sebastian Rittau
parent
bec2fef7fa
commit
c85fed8d98
@@ -2,7 +2,7 @@
|
||||
|
||||
from typing import (
|
||||
Any, AnyStr, Callable, Container, ContextManager, Dict, FrozenSet, Generic, Iterable,
|
||||
Iterator, List, NoReturn, Optional, overload, Pattern, Sequence, Set, TextIO,
|
||||
Iterator, List, NoReturn, Optional, overload, Pattern, Sequence, Set, IO,
|
||||
Tuple, Type, TypeVar, Union
|
||||
)
|
||||
import logging
|
||||
@@ -289,7 +289,11 @@ class TestResult:
|
||||
class TextTestResult(TestResult):
|
||||
separator1: str
|
||||
separator2: str
|
||||
def __init__(self, stream: TextIO, descriptions: bool,
|
||||
stream: IO[str]
|
||||
showAll: bool
|
||||
dots: bool
|
||||
descriptions: bool
|
||||
def __init__(self, stream: IO[str], descriptions: bool,
|
||||
verbosity: int) -> None: ...
|
||||
def getDescription(self, test: TestCase) -> str: ...
|
||||
def printErrors(self) -> None: ...
|
||||
@@ -298,14 +302,22 @@ _TextTestResult = TextTestResult
|
||||
|
||||
defaultTestLoader = ... # type: TestLoader
|
||||
|
||||
_ResultClassType = Callable[[TextIO, bool, int], TestResult]
|
||||
_ResultClassType = Callable[[IO[str], bool, int], TestResult]
|
||||
|
||||
class TestRunner:
|
||||
def run(self, test: Union[TestSuite, TestCase]) -> TestResult: ...
|
||||
|
||||
class TextTestRunner(TestRunner):
|
||||
stream: IO[str]
|
||||
descriptions: bool
|
||||
verbosity: int
|
||||
failfast: bool
|
||||
buffer: bool
|
||||
tb_locals: bool
|
||||
warnings: Optional[Type[Warning]]
|
||||
resultclass: _ResultClassType
|
||||
if sys.version_info >= (3, 5):
|
||||
def __init__(self, stream: Optional[TextIO] = ...,
|
||||
def __init__(self, stream: Optional[IO[str]] = ...,
|
||||
descriptions: bool = ..., verbosity: int = ...,
|
||||
failfast: bool = ..., buffer: bool = ...,
|
||||
resultclass: Optional[_ResultClassType] = ...,
|
||||
@@ -313,7 +325,7 @@ class TextTestRunner(TestRunner):
|
||||
*, tb_locals: bool = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self,
|
||||
stream: Optional[TextIO] = ...,
|
||||
stream: Optional[IO[str]] = ...,
|
||||
descriptions: bool = ..., verbosity: int = ...,
|
||||
failfast: bool = ..., buffer: bool = ...,
|
||||
resultclass: Optional[_ResultClassType] = ...,
|
||||
|
||||
Reference in New Issue
Block a user