Use _typeshed.OptExcInfo in pydoc and unittest (#7668)

This commit is contained in:
Alex Waygood
2022-04-20 21:00:48 +01:00
committed by GitHub
parent b093c90a94
commit a8504f269e
2 changed files with 8 additions and 15 deletions

View File

@@ -1,10 +1,7 @@
import unittest.case
from _typeshed import OptExcInfo
from collections.abc import Callable
from types import TracebackType
from typing import Any, TextIO, TypeVar, Union
from typing_extensions import TypeAlias
_SysExcInfoType: TypeAlias = Union[tuple[type[BaseException], BaseException, TracebackType], tuple[None, None, None]]
from typing import Any, TextIO, TypeVar
_F = TypeVar("_F", bound=Callable[..., Any])
@@ -33,10 +30,10 @@ class TestResult:
def stopTest(self, test: unittest.case.TestCase) -> None: ...
def startTestRun(self) -> None: ...
def stopTestRun(self) -> None: ...
def addError(self, test: unittest.case.TestCase, err: _SysExcInfoType) -> None: ...
def addFailure(self, test: unittest.case.TestCase, err: _SysExcInfoType) -> None: ...
def addError(self, test: unittest.case.TestCase, err: OptExcInfo) -> None: ...
def addFailure(self, test: unittest.case.TestCase, err: OptExcInfo) -> None: ...
def addSuccess(self, test: unittest.case.TestCase) -> None: ...
def addSkip(self, test: unittest.case.TestCase, reason: str) -> None: ...
def addExpectedFailure(self, test: unittest.case.TestCase, err: _SysExcInfoType) -> None: ...
def addExpectedFailure(self, test: unittest.case.TestCase, err: OptExcInfo) -> None: ...
def addUnexpectedSuccess(self, test: unittest.case.TestCase) -> None: ...
def addSubTest(self, test: unittest.case.TestCase, subtest: unittest.case.TestCase, err: _SysExcInfoType | None) -> None: ...
def addSubTest(self, test: unittest.case.TestCase, subtest: unittest.case.TestCase, err: OptExcInfo | None) -> None: ...