mirror of
https://github.com/davidhalter/django-stubs.git
synced 2026-10-25 23:27:38 +08:00
reformat with black
This commit is contained in:
1 parent
4866354600
commit
cf85607969
343 files changed
+6054
-2158
No files matched your search
@@ -3,10 +3,7 @@ from django.contrib.auth.models import User
|
||||
from django.contrib.sessions.backends.base import SessionBase
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.dispatch.dispatcher import Signal
|
||||
from django.http.request import (
|
||||
HttpRequest,
|
||||
QueryDict,
|
||||
)
|
||||
from django.http.request import HttpRequest, QueryDict
|
||||
from django.http.response import (
|
||||
FileResponse,
|
||||
HttpResponse,
|
||||
@@ -17,42 +14,24 @@ from django.http.response import (
|
||||
from django.template.base import Template
|
||||
from django.template.context import Context
|
||||
from django.test.utils import ContextList
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Union,
|
||||
)
|
||||
from typing import Any, Callable, Dict, List, Optional, Union
|
||||
from urllib.parse import ParseResult
|
||||
|
||||
|
||||
def closing_iterator_wrapper(iterable: map, close: Callable) -> None: ...
|
||||
|
||||
|
||||
def conditional_content_removal(
|
||||
request: HttpRequest,
|
||||
response: HttpResponseBase
|
||||
request: HttpRequest, response: HttpResponseBase
|
||||
) -> HttpResponseBase: ...
|
||||
|
||||
|
||||
def encode_file(boundary: str, key: str, file: object) -> List[bytes]: ...
|
||||
|
||||
|
||||
def encode_multipart(boundary: str, data: Dict[str, Any]) -> bytes: ...
|
||||
|
||||
|
||||
def store_rendered_templates(
|
||||
store: Dict[str, Union[List[Template], ContextList]],
|
||||
signal: Signal,
|
||||
sender: Template,
|
||||
template: Template,
|
||||
context: Context,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
) -> None: ...
|
||||
|
||||
|
||||
class Client:
|
||||
def __init__(self, enforce_csrf_checks: bool = ..., **defaults) -> None: ...
|
||||
def _handle_redirects(
|
||||
@@ -60,10 +39,12 @@ class Client:
|
||||
response: Union[HttpResponseForbidden, HttpResponseRedirect],
|
||||
data: Any = ...,
|
||||
content_type: str = ...,
|
||||
**extra
|
||||
**extra,
|
||||
) -> HttpResponse: ...
|
||||
def _login(self, user: AbstractBaseUser, backend: Optional[str] = ...) -> None: ...
|
||||
def _parse_json(self, response: HttpResponse, **extra) -> Dict[str, Union[int, str]]: ...
|
||||
def _parse_json(
|
||||
self, response: HttpResponse, **extra
|
||||
) -> Dict[str, Union[int, str]]: ...
|
||||
def delete(
|
||||
self,
|
||||
path: str,
|
||||
@@ -71,7 +52,7 @@ class Client:
|
||||
content_type: str = ...,
|
||||
follow: bool = ...,
|
||||
secure: bool = ...,
|
||||
**extra
|
||||
**extra,
|
||||
) -> HttpResponse: ...
|
||||
def force_login(self, user: User, backend: Optional[str] = ...) -> None: ...
|
||||
def get(
|
||||
@@ -80,7 +61,7 @@ class Client:
|
||||
data: Optional[Union[Dict[str, str], QueryDict]] = ...,
|
||||
follow: bool = ...,
|
||||
secure: bool = ...,
|
||||
**extra
|
||||
**extra,
|
||||
) -> HttpResponseBase: ...
|
||||
def head(
|
||||
self,
|
||||
@@ -88,7 +69,7 @@ class Client:
|
||||
data: Optional[Dict[str, str]] = ...,
|
||||
follow: bool = ...,
|
||||
secure: bool = ...,
|
||||
**extra
|
||||
**extra,
|
||||
) -> HttpResponse: ...
|
||||
def login(self, **credentials) -> bool: ...
|
||||
def logout(self) -> None: ...
|
||||
@@ -99,7 +80,7 @@ class Client:
|
||||
content_type: str = ...,
|
||||
follow: bool = ...,
|
||||
secure: bool = ...,
|
||||
**extra
|
||||
**extra,
|
||||
) -> HttpResponse: ...
|
||||
def patch(
|
||||
self,
|
||||
@@ -108,7 +89,7 @@ class Client:
|
||||
content_type: str = ...,
|
||||
follow: bool = ...,
|
||||
secure: bool = ...,
|
||||
**extra
|
||||
**extra,
|
||||
) -> HttpResponse: ...
|
||||
def post(
|
||||
self,
|
||||
@@ -117,7 +98,7 @@ class Client:
|
||||
content_type: str = ...,
|
||||
follow: bool = ...,
|
||||
secure: bool = ...,
|
||||
**extra
|
||||
**extra,
|
||||
) -> HttpResponse: ...
|
||||
def put(
|
||||
self,
|
||||
@@ -126,7 +107,7 @@ class Client:
|
||||
content_type: str = ...,
|
||||
follow: bool = ...,
|
||||
secure: bool = ...,
|
||||
**extra
|
||||
**extra,
|
||||
) -> HttpResponse: ...
|
||||
def request(self, **request): ...
|
||||
@property
|
||||
@@ -138,24 +119,21 @@ class Client:
|
||||
data: Dict[str, str] = ...,
|
||||
follow: bool = ...,
|
||||
secure: bool = ...,
|
||||
**extra
|
||||
**extra,
|
||||
) -> HttpResponse: ...
|
||||
|
||||
|
||||
class ClientHandler:
|
||||
def __call__(self, environ: Dict[str, Any]) -> HttpResponseBase: ...
|
||||
def __init__(self, enforce_csrf_checks: bool = ..., *args, **kwargs) -> None: ...
|
||||
|
||||
|
||||
class FakePayload:
|
||||
def __init__(self, content: Optional[Union[str, bytes]] = ...) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
def read(self, num_bytes: int = ...) -> bytes: ...
|
||||
def write(self, content: Union[str, bytes]) -> None: ...
|
||||
|
||||
|
||||
class RequestFactory:
|
||||
def __init__(self, *, json_encoder = ..., **defaults) -> None: ...
|
||||
def __init__(self, *, json_encoder=..., **defaults) -> None: ...
|
||||
def _base_environ(self, **request) -> Dict[str, Any]: ...
|
||||
def _encode_data(self, data: Any, content_type: str) -> bytes: ...
|
||||
def _encode_json(self, data: Any, content_type: str) -> Any: ...
|
||||
@@ -166,7 +144,7 @@ class RequestFactory:
|
||||
data: Union[str, Dict[str, int]] = ...,
|
||||
content_type: str = ...,
|
||||
secure: bool = ...,
|
||||
**extra
|
||||
**extra,
|
||||
) -> Union[WSGIRequest, HttpResponse]: ...
|
||||
def generic(
|
||||
self,
|
||||
@@ -175,21 +153,13 @@ class RequestFactory:
|
||||
data: Union[str, bytes, Dict[str, str]] = ...,
|
||||
content_type: Optional[str] = ...,
|
||||
secure: bool = ...,
|
||||
**extra
|
||||
**extra,
|
||||
) -> Union[WSGIRequest, HttpResponseBase]: ...
|
||||
def get(
|
||||
self,
|
||||
path: str,
|
||||
data: Any = ...,
|
||||
secure: bool = ...,
|
||||
**extra
|
||||
self, path: str, data: Any = ..., secure: bool = ..., **extra
|
||||
) -> Union[WSGIRequest, HttpResponse, FileResponse]: ...
|
||||
def head(
|
||||
self,
|
||||
path: str,
|
||||
data: Optional[Dict[str, str]] = ...,
|
||||
secure: bool = ...,
|
||||
**extra
|
||||
self, path: str, data: Optional[Dict[str, str]] = ..., secure: bool = ..., **extra
|
||||
) -> Union[WSGIRequest, HttpResponse]: ...
|
||||
def options(
|
||||
self,
|
||||
@@ -197,7 +167,7 @@ class RequestFactory:
|
||||
data: Dict[str, str] = ...,
|
||||
content_type: str = ...,
|
||||
secure: bool = ...,
|
||||
**extra
|
||||
**extra,
|
||||
) -> HttpResponseRedirect: ...
|
||||
def patch(
|
||||
self,
|
||||
@@ -205,7 +175,7 @@ class RequestFactory:
|
||||
data: str = ...,
|
||||
content_type: str = ...,
|
||||
secure: bool = ...,
|
||||
**extra
|
||||
**extra,
|
||||
) -> HttpResponse: ...
|
||||
def post(
|
||||
self,
|
||||
@@ -213,7 +183,7 @@ class RequestFactory:
|
||||
data: Any = ...,
|
||||
content_type: str = ...,
|
||||
secure: bool = ...,
|
||||
**extra
|
||||
**extra,
|
||||
) -> Union[WSGIRequest, HttpResponseBase]: ...
|
||||
def put(
|
||||
self,
|
||||
@@ -221,12 +191,9 @@ class RequestFactory:
|
||||
data: Union[str, Dict[str, str]] = ...,
|
||||
content_type: str = ...,
|
||||
secure: bool = ...,
|
||||
**extra
|
||||
**extra,
|
||||
) -> HttpResponse: ...
|
||||
def request(self, **request) -> WSGIRequest: ...
|
||||
def trace(
|
||||
self,
|
||||
path: str,
|
||||
secure: bool = ...,
|
||||
**extra
|
||||
) -> Union[WSGIRequest, HttpResponse]: ...
|
||||
self, path: str, secure: bool = ..., **extra
|
||||
) -> Union[WSGIRequest, HttpResponse]: ...
|
||||
@@ -6,6 +6,7 @@ from html.parser import HTMLParser
|
||||
from typing import Any, Optional
|
||||
|
||||
from typing import List, Optional, Tuple, Union
|
||||
|
||||
WHITESPACE: Any
|
||||
|
||||
def normalize_whitespace(string: str) -> str: ...
|
||||
@@ -14,7 +15,16 @@ class Element:
|
||||
name: Any = ...
|
||||
attributes: Any = ...
|
||||
children: Any = ...
|
||||
def __init__(self, name: Optional[str], attributes: Union[Tuple, List[Union[Tuple[str, str], Tuple[str, None]]], List[Tuple[str, None]], List[Tuple[str, str]]]) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
name: Optional[str],
|
||||
attributes: Union[
|
||||
Tuple,
|
||||
List[Union[Tuple[str, str], Tuple[str, None]]],
|
||||
List[Tuple[str, None]],
|
||||
List[Tuple[str, str]],
|
||||
],
|
||||
) -> None: ...
|
||||
def append(self, element: Union[str, Element]) -> None: ...
|
||||
def finalize(self) -> None: ...
|
||||
def __eq__(self, element: Union[str, Element]) -> bool: ...
|
||||
@@ -39,11 +49,17 @@ class Parser(HTMLParser):
|
||||
element_positions: Any = ...
|
||||
def __init__(self) -> None: ...
|
||||
def error(self, msg: Any) -> None: ...
|
||||
def format_position(self, position: Optional[Any] = ..., element: Optional[Any] = ...): ...
|
||||
def format_position(
|
||||
self, position: Optional[Any] = ..., element: Optional[Any] = ...
|
||||
): ...
|
||||
@property
|
||||
def current(self) -> Element: ...
|
||||
def handle_startendtag(self, tag: str, attrs: List[Tuple[str, str]]) -> None: ...
|
||||
def handle_starttag(self, tag: str, attrs: Union[List[Union[Tuple[str, str], Tuple[str, None]]], List[Tuple[str, str]]]) -> None: ...
|
||||
def handle_starttag(
|
||||
self,
|
||||
tag: str,
|
||||
attrs: Union[List[Union[Tuple[str, str], Tuple[str, None]]], List[Tuple[str, str]]],
|
||||
) -> None: ...
|
||||
def handle_endtag(self, tag: str) -> None: ...
|
||||
def handle_data(self, data: str) -> None: ...
|
||||
def handle_charref(self, name: str) -> None: ...
|
||||
|
||||
@@ -13,6 +13,7 @@ from typing import Any, Dict, List, Optional, Set, Tuple, Type, Union
|
||||
from unittest.case import _SubTest
|
||||
from unittest.runner import TextTestResult
|
||||
from unittest.suite import TestSuite
|
||||
|
||||
class DebugSQLTextTestResult(unittest.TextTestResult):
|
||||
logger: Any = ...
|
||||
def __init__(self, stream: Any, descriptions: Any, verbosity: Any) -> None: ...
|
||||
@@ -23,7 +24,11 @@ class DebugSQLTextTestResult(unittest.TextTestResult):
|
||||
def addError(self, test: Any, err: Any) -> None: ...
|
||||
def addFailure(self, test: Any, err: Any) -> None: ...
|
||||
def addSubTest(self, test: TestCase, subtest: _SubTest, err: None) -> None: ...
|
||||
def printErrorList(self, flavour: str, errors: List[Union[Tuple[TestCase, str, str], Tuple[_SubTest, str, str]]]) -> None: ...
|
||||
def printErrorList(
|
||||
self,
|
||||
flavour: str,
|
||||
errors: List[Union[Tuple[TestCase, str, str], Tuple[_SubTest, str, str]]],
|
||||
) -> None: ...
|
||||
|
||||
class RemoteTestResult:
|
||||
events: Any = ...
|
||||
@@ -34,7 +39,9 @@ class RemoteTestResult:
|
||||
@property
|
||||
def test_index(self): ...
|
||||
def _confirm_picklable(self, obj: Any) -> None: ...
|
||||
def _print_unpicklable_subtest(self, test: Any, subtest: Any, pickle_exc: Any) -> None: ...
|
||||
def _print_unpicklable_subtest(
|
||||
self, test: Any, subtest: Any, pickle_exc: Any
|
||||
) -> None: ...
|
||||
def check_picklable(self, test: Any, err: Any) -> None: ...
|
||||
def check_subtest_picklable(self, test: Any, subtest: Any) -> None: ...
|
||||
def stop_if_failfast(self) -> None: ...
|
||||
@@ -92,23 +99,68 @@ class DiscoverRunner:
|
||||
parallel: Any = ...
|
||||
tags: Any = ...
|
||||
exclude_tags: Any = ...
|
||||
def __init__(self, pattern: None = ..., top_level: None = ..., verbosity: int = ..., interactive: bool = ..., failfast: bool = ..., keepdb: bool = ..., reverse: bool = ..., debug_mode: bool = ..., debug_sql: bool = ..., parallel: int = ..., tags: Optional[List[str]] = ..., exclude_tags: None = ..., **kwargs: Any) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
pattern: None = ...,
|
||||
top_level: None = ...,
|
||||
verbosity: int = ...,
|
||||
interactive: bool = ...,
|
||||
failfast: bool = ...,
|
||||
keepdb: bool = ...,
|
||||
reverse: bool = ...,
|
||||
debug_mode: bool = ...,
|
||||
debug_sql: bool = ...,
|
||||
parallel: int = ...,
|
||||
tags: Optional[List[str]] = ...,
|
||||
exclude_tags: None = ...,
|
||||
**kwargs: Any,
|
||||
) -> None: ...
|
||||
@classmethod
|
||||
def add_arguments(cls, parser: Any) -> None: ...
|
||||
def setup_test_environment(self, **kwargs: Any) -> None: ...
|
||||
def build_suite(self, test_labels: Union[Tuple[str, str], List[str], Tuple[str]] = ..., extra_tests: None = ..., **kwargs: Any) -> TestSuite: ...
|
||||
def setup_databases(self, **kwargs: Any) -> Union[List[Tuple[DatabaseWrapper, str, bool]], List[Tuple[DatabaseWrapper, str, bool]]]: ...
|
||||
def build_suite(
|
||||
self,
|
||||
test_labels: Union[Tuple[str, str], List[str], Tuple[str]] = ...,
|
||||
extra_tests: None = ...,
|
||||
**kwargs: Any,
|
||||
) -> TestSuite: ...
|
||||
def setup_databases(
|
||||
self, **kwargs: Any
|
||||
) -> Union[
|
||||
List[Tuple[DatabaseWrapper, str, bool]], List[Tuple[DatabaseWrapper, str, bool]]
|
||||
]: ...
|
||||
def get_resultclass(self) -> None: ...
|
||||
def get_test_runner_kwargs(self) -> Dict[str, Optional[int]]: ...
|
||||
def run_checks(self) -> None: ...
|
||||
def run_suite(self, suite: TestSuite, **kwargs: Any) -> TextTestResult: ...
|
||||
def teardown_databases(self, old_config: Union[List[Tuple[DatabaseWrapper, str, bool]], List[Tuple[DatabaseWrapper, str, bool]]], **kwargs: Any) -> None: ...
|
||||
def teardown_databases(
|
||||
self,
|
||||
old_config: Union[
|
||||
List[Tuple[DatabaseWrapper, str, bool]], List[Tuple[DatabaseWrapper, str, bool]]
|
||||
],
|
||||
**kwargs: Any,
|
||||
) -> None: ...
|
||||
def teardown_test_environment(self, **kwargs: Any) -> None: ...
|
||||
def suite_result(self, suite: TestSuite, result: TextTestResult, **kwargs: Any) -> int: ...
|
||||
def run_tests(self, test_labels: List[str], extra_tests: List[Any] = ..., **kwargs: Any) -> int: ...
|
||||
def suite_result(
|
||||
self, suite: TestSuite, result: TextTestResult, **kwargs: Any
|
||||
) -> int: ...
|
||||
def run_tests(
|
||||
self, test_labels: List[str], extra_tests: List[Any] = ..., **kwargs: Any
|
||||
) -> int: ...
|
||||
|
||||
def is_discoverable(label: str) -> bool: ...
|
||||
def reorder_suite(suite: TestSuite, classes: Tuple[Type[TestCase], Type[SimpleTestCase]], reverse: bool = ...) -> TestSuite: ...
|
||||
def partition_suite_by_type(suite: TestSuite, classes: Tuple[Type[TestCase], Type[SimpleTestCase]], bins: List[OrderedSet], reverse: bool = ...) -> None: ...
|
||||
def reorder_suite(
|
||||
suite: TestSuite,
|
||||
classes: Tuple[Type[TestCase], Type[SimpleTestCase]],
|
||||
reverse: bool = ...,
|
||||
) -> TestSuite: ...
|
||||
def partition_suite_by_type(
|
||||
suite: TestSuite,
|
||||
classes: Tuple[Type[TestCase], Type[SimpleTestCase]],
|
||||
bins: List[OrderedSet],
|
||||
reverse: bool = ...,
|
||||
) -> None: ...
|
||||
def partition_suite_by_case(suite: Any): ...
|
||||
def filter_tests_by_tags(suite: TestSuite, tags: Set[str], exclude_tags: Set[str]) -> TestSuite: ...
|
||||
def filter_tests_by_tags(
|
||||
suite: TestSuite, tags: Set[str], exclude_tags: Set[str]
|
||||
) -> TestSuite: ...
|
||||
@@ -8,10 +8,19 @@ from typing import Any
|
||||
from django.contrib.admin.tests import AdminSeleniumTestCase
|
||||
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
|
||||
from typing import Callable, Dict, List, Tuple, Type, Union
|
||||
|
||||
class SeleniumTestCaseBase:
|
||||
browsers: Any = ...
|
||||
browser: Any = ...
|
||||
def __new__(cls: Type[SeleniumTestCaseBase], name: str, bases: Union[Tuple[Type[AdminSeleniumTestCase]], Tuple[Type[SeleniumTestCase], Type[StaticLiveServerTestCase]]], attrs: Dict[str, Union[str, List[str], Callable]]) -> Type[AdminSeleniumTestCase]: ...
|
||||
def __new__(
|
||||
cls: Type[SeleniumTestCaseBase],
|
||||
name: str,
|
||||
bases: Union[
|
||||
Tuple[Type[AdminSeleniumTestCase]],
|
||||
Tuple[Type[SeleniumTestCase], Type[StaticLiveServerTestCase]],
|
||||
],
|
||||
attrs: Dict[str, Union[str, List[str], Callable]],
|
||||
) -> Type[AdminSeleniumTestCase]: ...
|
||||
@classmethod
|
||||
def import_webdriver(cls, browser: Any): ...
|
||||
def create_webdriver(self): ...
|
||||
|
||||
+140
-23
@@ -15,6 +15,7 @@ from django.http.response import HttpResponse, HttpResponseBase
|
||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union
|
||||
from unittest.case import _AssertRaisesContext, _AssertWarnsContext
|
||||
from unittest.runner import TextTestResult
|
||||
|
||||
class _AssertNumQueriesContext(CaptureQueriesContext):
|
||||
test_case: Any = ...
|
||||
num: Any = ...
|
||||
@@ -28,7 +29,9 @@ class _AssertTemplateUsedContext:
|
||||
rendered_template_names: Any = ...
|
||||
context: Any = ...
|
||||
def __init__(self, test_case: Any, template_name: Any) -> None: ...
|
||||
def on_template_render(self, sender: Any, signal: Any, template: Any, context: Any, **kwargs: Any) -> None: ...
|
||||
def on_template_render(
|
||||
self, sender: Any, signal: Any, template: Any, context: Any, **kwargs: Any
|
||||
) -> None: ...
|
||||
def test(self): ...
|
||||
def message(self): ...
|
||||
def __enter__(self): ...
|
||||
@@ -59,25 +62,117 @@ class SimpleTestCase(unittest.TestCase):
|
||||
def _post_teardown(self) -> None: ...
|
||||
def settings(self, **kwargs: Any): ...
|
||||
def modify_settings(self, **kwargs: Any): ...
|
||||
def assertRedirects(self, response: Any, expected_url: Any, status_code: int = ..., target_status_code: int = ..., msg_prefix: str = ..., fetch_redirect_response: bool = ...) -> None: ...
|
||||
def _assert_contains(self, response: HttpResponseBase, text: Union[str, bytes, int], status_code: int, msg_prefix: str, html: bool) -> Tuple[str, int, str]: ...
|
||||
def assertContains(self, response: Any, text: Any, count: Optional[Any] = ..., status_code: int = ..., msg_prefix: str = ..., html: bool = ...) -> None: ...
|
||||
def assertNotContains(self, response: Any, text: Any, status_code: int = ..., msg_prefix: str = ..., html: bool = ...) -> None: ...
|
||||
def assertFormError(self, response: Any, form: Any, field: Any, errors: Any, msg_prefix: str = ...) -> None: ...
|
||||
def assertFormsetError(self, response: Any, formset: Any, form_index: Any, field: Any, errors: Any, msg_prefix: str = ...) -> None: ...
|
||||
def _assert_template_used(self, response: Optional[Union[str, HttpResponse]], template_name: Optional[str], msg_prefix: str) -> Union[Tuple[None, List[Any], str], Tuple[str, None, str], Tuple[None, List[str], str]]: ...
|
||||
def assertTemplateUsed(self, response: Optional[Any] = ..., template_name: Optional[Any] = ..., msg_prefix: str = ..., count: Optional[Any] = ...): ...
|
||||
def assertTemplateNotUsed(self, response: Optional[Any] = ..., template_name: Optional[Any] = ..., msg_prefix: str = ...): ...
|
||||
def _assert_raises_or_warns_cm(self, func: Callable, cm_attr: str, expected_exception: Type[Exception], expected_message: str) -> Iterator[Union[_AssertRaisesContext, _AssertWarnsContext]]: ...
|
||||
def _assertFooMessage(self, func: Callable, cm_attr: str, expected_exception: Type[Exception], expected_message: str, *args: Any, **kwargs: Any) -> _GeneratorContextManager: ...
|
||||
def assertRaisesMessage(self, expected_exception: Any, expected_message: Any, *args: Any, **kwargs: Any): ...
|
||||
def assertWarnsMessage(self, expected_warning: Any, expected_message: Any, *args: Any, **kwargs: Any): ...
|
||||
def assertFieldOutput(self, fieldclass: Any, valid: Any, invalid: Any, field_args: Optional[Any] = ..., field_kwargs: Optional[Any] = ..., empty_value: str = ...) -> None: ...
|
||||
def assertRedirects(
|
||||
self,
|
||||
response: Any,
|
||||
expected_url: Any,
|
||||
status_code: int = ...,
|
||||
target_status_code: int = ...,
|
||||
msg_prefix: str = ...,
|
||||
fetch_redirect_response: bool = ...,
|
||||
) -> None: ...
|
||||
def _assert_contains(
|
||||
self,
|
||||
response: HttpResponseBase,
|
||||
text: Union[str, bytes, int],
|
||||
status_code: int,
|
||||
msg_prefix: str,
|
||||
html: bool,
|
||||
) -> Tuple[str, int, str]: ...
|
||||
def assertContains(
|
||||
self,
|
||||
response: Any,
|
||||
text: Any,
|
||||
count: Optional[Any] = ...,
|
||||
status_code: int = ...,
|
||||
msg_prefix: str = ...,
|
||||
html: bool = ...,
|
||||
) -> None: ...
|
||||
def assertNotContains(
|
||||
self,
|
||||
response: Any,
|
||||
text: Any,
|
||||
status_code: int = ...,
|
||||
msg_prefix: str = ...,
|
||||
html: bool = ...,
|
||||
) -> None: ...
|
||||
def assertFormError(
|
||||
self, response: Any, form: Any, field: Any, errors: Any, msg_prefix: str = ...
|
||||
) -> None: ...
|
||||
def assertFormsetError(
|
||||
self,
|
||||
response: Any,
|
||||
formset: Any,
|
||||
form_index: Any,
|
||||
field: Any,
|
||||
errors: Any,
|
||||
msg_prefix: str = ...,
|
||||
) -> None: ...
|
||||
def _assert_template_used(
|
||||
self,
|
||||
response: Optional[Union[str, HttpResponse]],
|
||||
template_name: Optional[str],
|
||||
msg_prefix: str,
|
||||
) -> Union[
|
||||
Tuple[None, List[Any], str], Tuple[str, None, str], Tuple[None, List[str], str]
|
||||
]: ...
|
||||
def assertTemplateUsed(
|
||||
self,
|
||||
response: Optional[Any] = ...,
|
||||
template_name: Optional[Any] = ...,
|
||||
msg_prefix: str = ...,
|
||||
count: Optional[Any] = ...,
|
||||
): ...
|
||||
def assertTemplateNotUsed(
|
||||
self,
|
||||
response: Optional[Any] = ...,
|
||||
template_name: Optional[Any] = ...,
|
||||
msg_prefix: str = ...,
|
||||
): ...
|
||||
def _assert_raises_or_warns_cm(
|
||||
self,
|
||||
func: Callable,
|
||||
cm_attr: str,
|
||||
expected_exception: Type[Exception],
|
||||
expected_message: str,
|
||||
) -> Iterator[Union[_AssertRaisesContext, _AssertWarnsContext]]: ...
|
||||
def _assertFooMessage(
|
||||
self,
|
||||
func: Callable,
|
||||
cm_attr: str,
|
||||
expected_exception: Type[Exception],
|
||||
expected_message: str,
|
||||
*args: Any,
|
||||
**kwargs: Any,
|
||||
) -> _GeneratorContextManager: ...
|
||||
def assertRaisesMessage(
|
||||
self, expected_exception: Any, expected_message: Any, *args: Any, **kwargs: Any
|
||||
): ...
|
||||
def assertWarnsMessage(
|
||||
self, expected_warning: Any, expected_message: Any, *args: Any, **kwargs: Any
|
||||
): ...
|
||||
def assertFieldOutput(
|
||||
self,
|
||||
fieldclass: Any,
|
||||
valid: Any,
|
||||
invalid: Any,
|
||||
field_args: Optional[Any] = ...,
|
||||
field_kwargs: Optional[Any] = ...,
|
||||
empty_value: str = ...,
|
||||
) -> None: ...
|
||||
def assertHTMLEqual(self, html1: Any, html2: Any, msg: Optional[Any] = ...) -> None: ...
|
||||
def assertHTMLNotEqual(self, html1: Any, html2: Any, msg: Optional[Any] = ...) -> None: ...
|
||||
def assertInHTML(self, needle: Any, haystack: Any, count: Optional[Any] = ..., msg_prefix: str = ...) -> None: ...
|
||||
def assertJSONEqual(self, raw: Any, expected_data: Any, msg: Optional[Any] = ...) -> None: ...
|
||||
def assertJSONNotEqual(self, raw: Any, expected_data: Any, msg: Optional[Any] = ...) -> None: ...
|
||||
def assertHTMLNotEqual(
|
||||
self, html1: Any, html2: Any, msg: Optional[Any] = ...
|
||||
) -> None: ...
|
||||
def assertInHTML(
|
||||
self, needle: Any, haystack: Any, count: Optional[Any] = ..., msg_prefix: str = ...
|
||||
) -> None: ...
|
||||
def assertJSONEqual(
|
||||
self, raw: Any, expected_data: Any, msg: Optional[Any] = ...
|
||||
) -> None: ...
|
||||
def assertJSONNotEqual(
|
||||
self, raw: Any, expected_data: Any, msg: Optional[Any] = ...
|
||||
) -> None: ...
|
||||
def assertXMLEqual(self, xml1: Any, xml2: Any, msg: Optional[Any] = ...) -> None: ...
|
||||
def assertXMLNotEqual(self, xml1: Any, xml2: Any, msg: Optional[Any] = ...) -> None: ...
|
||||
|
||||
@@ -96,8 +191,22 @@ class TransactionTestCase(SimpleTestCase):
|
||||
def _should_reload_connections(self): ...
|
||||
def _post_teardown(self) -> None: ...
|
||||
def _fixture_teardown(self) -> None: ...
|
||||
def assertQuerysetEqual(self, qs: Any, values: Any, transform: Any = ..., ordered: bool = ..., msg: Optional[Any] = ...): ...
|
||||
def assertNumQueries(self, num: Any, func: Optional[Any] = ..., *args: Any, using: Any = ..., **kwargs: Any): ...
|
||||
def assertQuerysetEqual(
|
||||
self,
|
||||
qs: Any,
|
||||
values: Any,
|
||||
transform: Any = ...,
|
||||
ordered: bool = ...,
|
||||
msg: Optional[Any] = ...,
|
||||
): ...
|
||||
def assertNumQueries(
|
||||
self,
|
||||
num: Any,
|
||||
func: Optional[Any] = ...,
|
||||
*args: Any,
|
||||
using: Any = ...,
|
||||
**kwargs: Any,
|
||||
): ...
|
||||
|
||||
class TestCase(TransactionTestCase):
|
||||
@classmethod
|
||||
@@ -153,7 +262,13 @@ class LiveServerThread(threading.Thread):
|
||||
error: Any = ...
|
||||
static_handler: Any = ...
|
||||
connections_override: Any = ...
|
||||
def __init__(self, host: str, static_handler: Type[_StaticFilesHandler], connections_override: Dict[str, DatabaseWrapper] = ..., port: int = ...) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
host: str,
|
||||
static_handler: Type[_StaticFilesHandler],
|
||||
connections_override: Dict[str, DatabaseWrapper] = ...,
|
||||
port: int = ...,
|
||||
) -> None: ...
|
||||
httpd: Any = ...
|
||||
def run(self) -> None: ...
|
||||
def _create_server(self): ...
|
||||
@@ -168,7 +283,9 @@ class LiveServerTestCase(TransactionTestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls) -> None: ...
|
||||
@classmethod
|
||||
def _create_server_thread(cls, connections_override: Dict[str, DatabaseWrapper]) -> LiveServerThread: ...
|
||||
def _create_server_thread(
|
||||
cls, connections_override: Dict[str, DatabaseWrapper]
|
||||
) -> LiveServerThread: ...
|
||||
@classmethod
|
||||
def _tearDownClassInternal(cls) -> None: ...
|
||||
@classmethod
|
||||
|
||||
+20
-75
@@ -12,168 +12,113 @@ from django.template.context import Context
|
||||
from django.test.runner import DiscoverRunner
|
||||
from django.test.testcases import SimpleTestCase
|
||||
from django.utils.safestring import SafeText
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
Iterator,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union
|
||||
|
||||
def captured_output(stream_name: str) -> Iterator[StringIO]: ...
|
||||
|
||||
|
||||
def captured_stderr() -> _GeneratorContextManager: ...
|
||||
|
||||
|
||||
def captured_stdout() -> _GeneratorContextManager: ...
|
||||
|
||||
|
||||
def compare_xml(want: str, got: str) -> bool: ...
|
||||
|
||||
|
||||
def dependency_ordered(
|
||||
test_databases: List[Tuple[str, Tuple[str, List[str]]]],
|
||||
dependencies: Dict[str, List[str]]
|
||||
dependencies: Dict[str, List[str]],
|
||||
) -> List[Tuple[str, Tuple[str, List[str]]]]: ...
|
||||
|
||||
|
||||
def extend_sys_path(*paths) -> Iterator[None]: ...
|
||||
|
||||
|
||||
def freeze_time(t: int) -> Iterator[None]: ...
|
||||
|
||||
|
||||
def get_runner(
|
||||
settings: LazySettings,
|
||||
test_runner_class: Optional[str] = ...
|
||||
settings: LazySettings, test_runner_class: Optional[str] = ...
|
||||
) -> Type[DiscoverRunner]: ...
|
||||
|
||||
|
||||
def get_unique_databases_and_mirrors() -> Tuple[OrderedDict, Dict[Any, Any]]: ...
|
||||
|
||||
|
||||
def instrumented_test_render(
|
||||
self: Template,
|
||||
context: Context
|
||||
) -> SafeText: ...
|
||||
|
||||
|
||||
def instrumented_test_render(self: Template, context: Context) -> SafeText: ...
|
||||
def require_jinja2(test_func: Callable) -> Callable: ...
|
||||
|
||||
|
||||
def setup_databases(
|
||||
verbosity: int,
|
||||
interactive: bool,
|
||||
keepdb: bool = ...,
|
||||
debug_sql: bool = ...,
|
||||
parallel: int = ...,
|
||||
**kwargs
|
||||
) -> Union[List[Tuple[DatabaseWrapper, str, bool]], List[Tuple[DatabaseWrapper, str, bool]]]: ...
|
||||
|
||||
|
||||
**kwargs,
|
||||
) -> Union[
|
||||
List[Tuple[DatabaseWrapper, str, bool]], List[Tuple[DatabaseWrapper, str, bool]]
|
||||
]: ...
|
||||
def setup_test_environment(debug: bool = ...) -> None: ...
|
||||
|
||||
|
||||
def tag(*tags) -> Callable: ...
|
||||
|
||||
|
||||
def teardown_databases(
|
||||
old_config: List[Tuple[DatabaseWrapper, str, bool]],
|
||||
verbosity: int,
|
||||
parallel: int = ...,
|
||||
keepdb: bool = ...
|
||||
keepdb: bool = ...,
|
||||
) -> None: ...
|
||||
|
||||
|
||||
def teardown_test_environment() -> None: ...
|
||||
|
||||
|
||||
class Approximate:
|
||||
def __eq__(self, other: Union[float, Decimal]) -> bool: ...
|
||||
def __init__(self, val: Union[float, Decimal], places: int = ...) -> None: ...
|
||||
|
||||
|
||||
class CaptureQueriesContext:
|
||||
def __enter__(self) -> CaptureQueriesContext: ...
|
||||
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
|
||||
def __getitem__(self, index: int) -> Dict[str, str]: ...
|
||||
def __init__(
|
||||
self,
|
||||
connection: Union[DefaultConnectionProxy, backends.sqlite3.base.DatabaseWrapper]
|
||||
connection: Union[DefaultConnectionProxy, backends.sqlite3.base.DatabaseWrapper],
|
||||
) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
@property
|
||||
def captured_queries(self) -> List[Dict[str, str]]: ...
|
||||
|
||||
|
||||
class ContextList:
|
||||
def __contains__(self, key: str) -> bool: ...
|
||||
def __getitem__(self, key: Union[str, int]) -> Any: ...
|
||||
def get(self, key: str, default: None = ...) -> str: ...
|
||||
|
||||
|
||||
class LoggingCaptureMixin:
|
||||
def setUp(self) -> None: ...
|
||||
def tearDown(self) -> None: ...
|
||||
|
||||
|
||||
class TestContextDecorator:
|
||||
def __call__(self, decorated: Any) -> Any: ...
|
||||
def __enter__(self) -> Optional[Apps]: ...
|
||||
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
|
||||
def __init__(self, attr_name: Optional[str] = ..., kwarg_name: Optional[str] = ...) -> None: ...
|
||||
def __init__(
|
||||
self, attr_name: Optional[str] = ..., kwarg_name: Optional[str] = ...
|
||||
) -> None: ...
|
||||
def decorate_callable(self, func: Callable) -> Callable: ...
|
||||
def decorate_class(
|
||||
self,
|
||||
cls: Type[SimpleTestCase]
|
||||
) -> Type[SimpleTestCase]: ...
|
||||
|
||||
def decorate_class(self, cls: Type[SimpleTestCase]) -> Type[SimpleTestCase]: ...
|
||||
|
||||
class ignore_warnings:
|
||||
def __init__(self, **kwargs) -> None: ...
|
||||
def disable(self) -> None: ...
|
||||
def enable(self) -> None: ...
|
||||
|
||||
|
||||
class isolate_apps:
|
||||
def __init__(self, *installed_apps, **kwargs) -> None: ...
|
||||
def disable(self) -> None: ...
|
||||
def enable(self) -> Apps: ...
|
||||
|
||||
|
||||
class modify_settings:
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def enable(self) -> None: ...
|
||||
def save_options(self, test_func: Type[SimpleTestCase]) -> None: ...
|
||||
|
||||
|
||||
class override_script_prefix:
|
||||
def __init__(self, prefix: str) -> None: ...
|
||||
def disable(self) -> None: ...
|
||||
def enable(self) -> None: ...
|
||||
|
||||
|
||||
class override_settings:
|
||||
def __init__(self, **kwargs) -> None: ...
|
||||
def decorate_class(
|
||||
self,
|
||||
cls: Type[Union[SimpleTestCase, LoggingCaptureMixin]]
|
||||
self, cls: Type[Union[SimpleTestCase, LoggingCaptureMixin]]
|
||||
) -> Type[Union[SimpleTestCase, LoggingCaptureMixin]]: ...
|
||||
def disable(self) -> None: ...
|
||||
def enable(self) -> None: ...
|
||||
def save_options(
|
||||
self,
|
||||
test_func: Type[Union[SimpleTestCase, LoggingCaptureMixin]]
|
||||
self, test_func: Type[Union[SimpleTestCase, LoggingCaptureMixin]]
|
||||
) -> None: ...
|
||||
|
||||
|
||||
class override_system_checks:
|
||||
def __init__(self, new_checks: List[Callable], deployment_checks: Optional[List[Callable]] = ...) -> None: ...
|
||||
def __init__(
|
||||
self, new_checks: List[Callable], deployment_checks: Optional[List[Callable]] = ...
|
||||
) -> None: ...
|
||||
def disable(self) -> None: ...
|
||||
def enable(self) -> None: ...
|
||||
def enable(self) -> None: ...
|
||||
Reference in new issue
Block a user