Upgrade black version (#7089)

This commit is contained in:
Shantanu
2022-01-30 16:27:06 -08:00
committed by GitHub
parent 9854926289
commit b88a6f19cd
173 changed files with 496 additions and 2 deletions

View File

@@ -21,6 +21,7 @@ class _AssertLogsContext(Generic[_L]):
no_logs: bool
else:
def __init__(self, test_case: TestCase, logger_name: str, level: int) -> None: ...
def __enter__(self) -> _L: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None

View File

@@ -44,9 +44,11 @@ else:
# this is generic over the logging watcher, but in lower versions
# the watcher is hard-coded.
_L = TypeVar("_L")
class _LoggingWatcher(NamedTuple):
records: list[logging.LogRecord]
output: list[str]
class _AssertLogsContext(_BaseTestCaseContext, Generic[_L]):
LOGGING_FORMAT: ClassVar[str]
test_case: TestCase
@@ -170,6 +172,7 @@ class TestCase:
def assertNoLogs(
self, logger: str | logging.Logger | None = ..., level: int | str | None = ...
) -> _AssertLogsContext[None]: ...
@overload
def assertAlmostEqual(
self, first: float, second: float, places: int | None = ..., msg: Any = ..., delta: float | None = ...
@@ -219,12 +222,14 @@ class TestCase:
def addCleanup(self, __function: Callable[_P, object], *args: _P.args, **kwargs: _P.kwargs) -> None: ...
else:
def addCleanup(self, function: Callable[_P, object], *args: _P.args, **kwargs: _P.kwargs) -> None: ...
def doCleanups(self) -> None: ...
if sys.version_info >= (3, 8):
@classmethod
def addClassCleanup(cls, __function: Callable[_P, object], *args: _P.args, **kwargs: _P.kwargs) -> None: ...
@classmethod
def doClassCleanups(cls) -> None: ...
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, 11):

View File

@@ -47,6 +47,7 @@ class TestProgram:
def createTests(self, from_discovery: bool = ..., Loader: unittest.loader.TestLoader | None = ...) -> None: ...
else:
def createTests(self) -> None: ...
def runTests(self) -> None: ... # undocumented
main = TestProgram

View File

@@ -93,6 +93,7 @@ class _Call(tuple[Any, ...]):
def args(self): ...
@property
def kwargs(self): ...
def call_list(self) -> Any: ...
call: _Call
@@ -138,10 +139,12 @@ class NonCallableMock(Base, Any):
else:
def assert_called(_mock_self) -> None: ...
def assert_called_once(_mock_self) -> None: ...
def reset_mock(self, visited: Any = ..., *, return_value: bool = ..., side_effect: bool = ...) -> None: ...
if sys.version_info >= (3, 7):
def _extract_mock_name(self) -> str: ...
def _get_call_signature_from_name(self, name: str) -> Any: ...
def assert_any_call(self, *args: Any, **kwargs: Any) -> None: ...
def assert_has_calls(self, calls: Sequence[_Call], any_order: bool = ...) -> None: ...
def mock_add_spec(self, spec: Any, spec_set: bool = ...) -> None: ...
@@ -225,6 +228,7 @@ class _patch(Generic[_T]):
new_callable: Any | None,
kwargs: Mapping[str, Any],
) -> None: ...
def copy(self) -> _patch[_T]: ...
@overload
def __call__(self, func: _TT) -> _TT: ...
@@ -232,10 +236,12 @@ class _patch(Generic[_T]):
def __call__(self, func: Callable[..., _R]) -> Callable[..., _R]: ...
if sys.version_info >= (3, 8):
def decoration_helper(self, patched, args, keywargs): ...
def decorate_class(self, klass: _TT) -> _TT: ...
def decorate_callable(self, func: Callable[..., _R]) -> Callable[..., _R]: ...
if sys.version_info >= (3, 8):
def decorate_async_callable(self, func: Callable[..., Awaitable[_R]]) -> Callable[..., Awaitable[_R]]: ...
def get_original(self) -> tuple[Any, bool]: ...
target: Any
temp_original: Any
@@ -367,6 +373,7 @@ class _patcher:
new_callable: Any | None = ...,
**kwargs: Any,
) -> _patch[MagicMock]: ...
def multiple(
self,
target: Any,
@@ -405,8 +412,10 @@ if sys.version_info >= (3, 8):
await_count: int
await_args: _Call | None
await_args_list: _CallList
class AsyncMagicMixin(MagicMixin):
def __init__(self, *args: Any, **kw: Any) -> None: ...
class AsyncMock(AsyncMockMixin, AsyncMagicMixin, Mock): ... # type: ignore # argument disparities between base classes
class MagicProxy:
@@ -415,6 +424,7 @@ class MagicProxy:
def __init__(self, name, parent) -> None: ...
if sys.version_info < (3, 8):
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
def create_mock(self): ...
def __get__(self, obj, _type: Any | None = ...): ...