mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Add unittest features new in Python 3.11 (#8020)
python/cpython@086c6b1
This commit is contained in:
@@ -33,7 +33,7 @@ if sys.version_info >= (3, 8):
|
||||
from .case import addModuleCleanup as addModuleCleanup
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from .case import doModuleCleanups as doModuleCleanups
|
||||
from .case import doModuleCleanups as doModuleCleanups, enterModuleContext as enterModuleContext
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
__all__ = [
|
||||
@@ -58,6 +58,7 @@ if sys.version_info >= (3, 11):
|
||||
"removeHandler",
|
||||
"addModuleCleanup",
|
||||
"doModuleCleanups",
|
||||
"enterModuleContext",
|
||||
"getTestCaseNames",
|
||||
"makeSuite",
|
||||
"findTestCases",
|
||||
|
||||
@@ -1,11 +1,19 @@
|
||||
import sys
|
||||
from collections.abc import Awaitable, Callable
|
||||
from typing import TypeVar
|
||||
from typing_extensions import ParamSpec
|
||||
|
||||
from .case import TestCase
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from contextlib import AbstractAsyncContextManager
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_P = ParamSpec("_P")
|
||||
|
||||
class IsolatedAsyncioTestCase(TestCase):
|
||||
async def asyncSetUp(self) -> None: ...
|
||||
async def asyncTearDown(self) -> None: ...
|
||||
def addAsyncCleanup(self, __func: Callable[_P, Awaitable[object]], *args: _P.args, **kwargs: _P.kwargs) -> None: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
async def enterAsyncContext(self, cm: AbstractAsyncContextManager[_T]) -> _T: ...
|
||||
|
||||
@@ -13,6 +13,7 @@ from warnings import WarningMessage
|
||||
if sys.version_info >= (3, 9):
|
||||
from types import GenericAlias
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_E = TypeVar("_E", bound=BaseException)
|
||||
_FT = TypeVar("_FT", bound=Callable[..., Any])
|
||||
_P = ParamSpec("_P")
|
||||
@@ -50,6 +51,9 @@ if sys.version_info >= (3, 8):
|
||||
def addModuleCleanup(__function: Callable[_P, object], *args: _P.args, **kwargs: _P.kwargs) -> None: ...
|
||||
def doModuleCleanups() -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
def enterModuleContext(cm: AbstractContextManager[_T]) -> _T: ...
|
||||
|
||||
def expectedFailure(test_item: _FT) -> _FT: ...
|
||||
def skip(reason: str) -> Callable[[_FT], _FT]: ...
|
||||
def skipIf(condition: object, reason: str) -> Callable[[_FT], _FT]: ...
|
||||
@@ -211,6 +215,9 @@ class TestCase:
|
||||
else:
|
||||
def addCleanup(self, function: Callable[_P, object], *args: _P.args, **kwargs: _P.kwargs) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
def enterContext(self, cm: AbstractContextManager[_T]) -> _T: ...
|
||||
|
||||
def doCleanups(self) -> None: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
@classmethod
|
||||
@@ -218,6 +225,10 @@ class TestCase:
|
||||
@classmethod
|
||||
def doClassCleanups(cls) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
@classmethod
|
||||
def enterClassContext(cls, cm: AbstractContextManager[_T]) -> _T: ...
|
||||
|
||||
def _formatMessage(self, msg: str | None, standardMsg: str) -> str: ... # undocumented
|
||||
def _getAssertEqualityFunc(self, first: Any, second: Any) -> Callable[..., None]: ... # undocumented
|
||||
if sys.version_info < (3, 12):
|
||||
|
||||
Reference in New Issue
Block a user