mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 05:51:52 +08:00
Annotations for remaining Python 3.8 additions (#3358)
* Add os.add_dll_directory() * Add memfd_create() and flags * Add type annotation to flags * Add stat_result.st_reparse_tag and flags * Add ncurses_version * Add Path.link_to() * Add Picker.reducer_override() * Add plistlib.UID * Add has_dualstack_ipv6() and create_server() * Add shlex.join() * Add SSL methods and fields * Add Python 3.8 statistics functions and classes * Remove obsolete sys.subversion * Add sys.unraisablehook * Add threading.excepthook * Add get_native_id() and Thread.native_id * Add Python 3.8 tkinter methods * Add CLOCK_UPTIME_RAW * Add SupportsIndex * Add typing.get_origin() and get_args() * Add unicodedata.is_normalized * Add unittest.mock.AsyncMock Currently this is just an alias for Any like Mock and MagicMock. All of these classes should probably be sub-classing Any and add their own methods. See also #3224. * Add unittest cleanup methods * Add IsolatedAsyncioTestCase * Add ElementTree.canonicalize() and C14NWriterTarget * cProfile.Profile can be used as a context manager * Add asyncio task name handling * mmap.flush() now always returns None * Add posonlyargcount to CodeType
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
from typing import Iterable, List, Optional, Type, Union
|
||||
from types import ModuleType
|
||||
|
||||
from unittest.async_case import *
|
||||
from unittest.case import *
|
||||
from unittest.loader import *
|
||||
from unittest.result import *
|
||||
|
||||
9
stdlib/3/unittest/async_case.pyi
Normal file
9
stdlib/3/unittest/async_case.pyi
Normal file
@@ -0,0 +1,9 @@
|
||||
import sys
|
||||
from typing import Any, Awaitable, Callable
|
||||
from .case import TestCase
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
class IsolatedAsyncioTestCase(TestCase):
|
||||
async def asyncSetUp(self) -> None: ...
|
||||
async def asyncTearDown(self) -> None: ...
|
||||
def addAsyncCleanup(self, __func: Callable[..., Awaitable[Any]], *args: Any, **kwargs: Any) -> None: ...
|
||||
@@ -1,16 +1,19 @@
|
||||
import logging
|
||||
import sys
|
||||
import unittest.result
|
||||
from types import TracebackType
|
||||
from typing import (
|
||||
Any, AnyStr, Callable, Container, ContextManager, Dict, FrozenSet, Generic,
|
||||
Iterable, List, NoReturn, Optional, overload, Pattern, Sequence, Set,
|
||||
Tuple, Type, TypeVar, Union,
|
||||
)
|
||||
import logging
|
||||
import unittest.result
|
||||
from types import TracebackType
|
||||
|
||||
|
||||
_E = TypeVar('_E', bound=BaseException)
|
||||
_FT = TypeVar('_FT', bound=Callable[..., Any])
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
def addModuleCleanup(__function: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ...
|
||||
def doModuleCleanups() -> None: ...
|
||||
|
||||
def expectedFailure(func: _FT) -> _FT: ...
|
||||
def skip(reason: str) -> Callable[[_FT], _FT]: ...
|
||||
@@ -154,6 +157,11 @@ class TestCase:
|
||||
def addCleanup(self, function: Callable[..., Any], *args: Any,
|
||||
**kwargs: Any) -> None: ...
|
||||
def doCleanups(self) -> None: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
@classmethod
|
||||
def addClassCleanup(cls, __function: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ...
|
||||
@classmethod
|
||||
def doClassCleanups(cls) -> None: ...
|
||||
def _formatMessage(self, msg: Optional[str], standardMsg: str) -> str: ... # undocumented
|
||||
def _getAssertEqualityFunc(self, first: Any, second: Any) -> Callable[..., None]: ... # undocumented
|
||||
# below is deprecated
|
||||
|
||||
@@ -98,6 +98,8 @@ class MagicMixin:
|
||||
|
||||
NonCallableMagicMock = Any
|
||||
MagicMock = Any
|
||||
if sys.version_info >= (3, 8):
|
||||
AsyncMock = Any
|
||||
|
||||
class MagicProxy:
|
||||
name: Any
|
||||
|
||||
Reference in New Issue
Block a user