Add _typeshed.(Opt)ExcInfo (#7645)

This commit is contained in:
Sebastian Rittau
2022-04-18 01:28:43 +02:00
committed by GitHub
parent a24b765388
commit 321359ca31
7 changed files with 26 additions and 31 deletions

View File

@@ -1,5 +1,6 @@
import types
import unittest
from _typeshed import ExcInfo
from typing import Any, Callable, NamedTuple
from typing_extensions import TypeAlias
@@ -125,7 +126,6 @@ class DocTestFinder:
) -> list[DocTest]: ...
_Out: TypeAlias = Callable[[str], Any]
_ExcInfo: TypeAlias = tuple[type[BaseException], BaseException, types.TracebackType]
class DocTestRunner:
DIVIDER: str
@@ -138,7 +138,7 @@ class DocTestRunner:
def report_start(self, out: _Out, test: DocTest, example: Example) -> None: ...
def report_success(self, out: _Out, test: DocTest, example: Example, got: str) -> None: ...
def report_failure(self, out: _Out, test: DocTest, example: Example, got: str) -> None: ...
def report_unexpected_exception(self, out: _Out, test: DocTest, example: Example, exc_info: _ExcInfo) -> None: ...
def report_unexpected_exception(self, out: _Out, test: DocTest, example: Example, exc_info: ExcInfo) -> None: ...
def run(
self, test: DocTest, compileflags: int | None = ..., out: _Out | None = ..., clear_globs: bool = ...
) -> TestResults: ...
@@ -158,8 +158,8 @@ class DocTestFailure(Exception):
class UnexpectedException(Exception):
test: DocTest
example: Example
exc_info: _ExcInfo
def __init__(self, test: DocTest, example: Example, exc_info: _ExcInfo) -> None: ...
exc_info: ExcInfo
def __init__(self, test: DocTest, example: Example, exc_info: ExcInfo) -> None: ...
class DebugRunner(DocTestRunner): ...