move generated stubs to separate directory, too messty

This commit is contained in:
Maxim Kurnikov
2018-11-10 17:49:18 +03:00
parent 7436d641e3
commit 96cd3ddb27
446 changed files with 58 additions and 71 deletions
+9
View File
@@ -0,0 +1,9 @@
from .testcases import (
TestCase as TestCase,
TransactionTestCase as TransactionTestCase,
SimpleTestCase as SimpleTestCase
)
from .utils import (
override_settings as override_settings
)
+203
View File
@@ -0,0 +1,203 @@
from datetime import date
from typing import Any, Callable, Dict, List, Optional, Union
from django.contrib.auth.models import User
from django.contrib.sessions.backends.base import SessionBase
from django.core.handlers.base import BaseHandler
from django.core.handlers.wsgi import WSGIRequest
from django.dispatch.dispatcher import Signal
from django.http.request import HttpRequest, QueryDict
from django.http.response import (HttpResponse, HttpResponseBase,
HttpResponseRedirect)
from django.template.base import Template
from django.template.context import Context
from django.test.utils import ContextList
class RedirectCycleError(Exception):
last_response: django.http.response.HttpResponseRedirect = ...
redirect_chain: List[Tuple[str, int]] = ...
def __init__(
self, message: str, last_response: HttpResponseRedirect
) -> None: ...
class FakePayload:
read_started: bool = ...
def __init__(self, content: Optional[Union[bytes, str]] = ...) -> None: ...
def __len__(self) -> int: ...
def read(self, num_bytes: int = ...) -> bytes: ...
def write(self, content: Union[bytes, str]) -> None: ...
class ClientHandler(BaseHandler):
enforce_csrf_checks: bool = ...
def __init__(
self, enforce_csrf_checks: bool = ..., *args: Any, **kwargs: Any
) -> None: ...
def __call__(self, environ: Dict[str, Any]) -> HttpResponseBase: ...
def encode_multipart(boundary: str, data: Dict[str, Any]) -> bytes: ...
def encode_file(boundary: str, key: str, file: Any) -> List[bytes]: ...
class RequestFactory:
json_encoder: Type[django.core.serializers.json.DjangoJSONEncoder] = ...
defaults: Dict[str, str] = ...
cookies: http.cookies.SimpleCookie = ...
errors: _io.BytesIO = ...
def __init__(self, *, json_encoder: Any = ..., **defaults: Any) -> None: ...
def request(self, **request: Any) -> WSGIRequest: ...
def get(
self,
path: str,
data: Optional[Union[Dict[str, date], QueryDict, str]] = ...,
secure: bool = ...,
**extra: Any
) -> Union[WSGIRequest, HttpResponseBase]: ...
def post(
self,
path: str,
data: Any = ...,
content_type: str = ...,
secure: bool = ...,
**extra: Any
) -> Union[WSGIRequest, HttpResponseBase]: ...
def head(
self,
path: str,
data: Optional[Union[Dict[str, str], str]] = ...,
secure: bool = ...,
**extra: Any
) -> Union[WSGIRequest, HttpResponse]: ...
def trace(
self, path: str, secure: bool = ..., **extra: Any
) -> Union[WSGIRequest, HttpResponse]: ...
def options(
self,
path: str,
data: Union[Dict[str, str], str] = ...,
content_type: str = ...,
secure: bool = ...,
**extra: Any
) -> Union[WSGIRequest, HttpResponse]: ...
def put(
self,
path: str,
data: Union[Dict[str, int], Dict[str, str], bytes, str] = ...,
content_type: str = ...,
secure: bool = ...,
**extra: Any
) -> Union[WSGIRequest, HttpResponse]: ...
def patch(
self,
path: str,
data: Union[Dict[str, int], Dict[str, str], str] = ...,
content_type: str = ...,
secure: bool = ...,
**extra: Any
) -> Union[WSGIRequest, HttpResponse]: ...
def delete(
self,
path: str,
data: Union[Dict[str, int], Dict[str, str], str] = ...,
content_type: str = ...,
secure: bool = ...,
**extra: Any
) -> Union[WSGIRequest, HttpResponse]: ...
def generic(
self,
method: str,
path: str,
data: Union[Dict[str, str], bytes, str] = ...,
content_type: Optional[str] = ...,
secure: bool = ...,
**extra: Any
) -> Union[WSGIRequest, HttpResponseBase]: ...
class Client(RequestFactory):
defaults: Dict[str, str]
errors: _io.BytesIO
json_encoder: Union[
Type[django.core.serializers.json.DjangoJSONEncoder],
unittest.mock.MagicMock,
]
handler: django.test.client.ClientHandler = ...
exc_info: None = ...
def __init__(
self, enforce_csrf_checks: bool = ..., **defaults: Any
) -> None: ...
def store_exc_info(self, **kwargs: Any) -> None: ...
@property
def session(self) -> SessionBase: ...
def request(self, **request: Any) -> Any: ...
def get(
self,
path: str,
data: Optional[Union[Dict[str, Union[int, str]], QueryDict, str]] = ...,
follow: bool = ...,
secure: bool = ...,
**extra: Any
) -> HttpResponseBase: ...
def post(
self,
path: str,
data: Any = ...,
content_type: str = ...,
follow: bool = ...,
secure: bool = ...,
**extra: Any
) -> HttpResponseBase: ...
def head(
self,
path: str,
data: Optional[Union[Dict[str, str], str]] = ...,
follow: bool = ...,
secure: bool = ...,
**extra: Any
) -> HttpResponse: ...
def options(
self,
path: str,
data: Union[Dict[str, str], str] = ...,
content_type: str = ...,
follow: bool = ...,
secure: bool = ...,
**extra: Any
) -> HttpResponse: ...
def put(
self,
path: str,
data: Union[Dict[str, int], Dict[str, str], bytes, str] = ...,
content_type: str = ...,
follow: bool = ...,
secure: bool = ...,
**extra: Any
) -> HttpResponse: ...
def patch(
self,
path: str,
data: Union[Dict[str, int], Dict[str, str], str] = ...,
content_type: str = ...,
follow: bool = ...,
secure: bool = ...,
**extra: Any
) -> HttpResponse: ...
def delete(
self,
path: str,
data: Union[Dict[str, int], Dict[str, str], str] = ...,
content_type: str = ...,
follow: bool = ...,
secure: bool = ...,
**extra: Any
) -> HttpResponse: ...
def trace(
self,
path: str,
data: Union[Dict[str, str], str] = ...,
follow: bool = ...,
secure: bool = ...,
**extra: Any
) -> HttpResponse: ...
def login(self, **credentials: Any) -> bool: ...
def force_login(self, user: User, backend: Optional[str] = ...) -> None: ...
cookies: http.cookies.SimpleCookie = ...
def logout(self) -> None: ...
+55
View File
@@ -0,0 +1,55 @@
from html.parser import HTMLParser
from typing import Any, List, Optional, Tuple, Union, TypeVar
_Self = TypeVar('_Self')
WHITESPACE: Any
def normalize_whitespace(string: str) -> str: ...
class Element:
name: Optional[str] = ...
attributes: List[Tuple[str, Optional[str]]] = ...
children: List[Union[Element, str]] = ...
def __init__(
self,
name: Optional[str],
attributes: Union[List[Tuple[str, Optional[str]]], Tuple],
) -> None: ...
def append(self, element: Union[Element, str]) -> None: ...
def finalize(self) -> None: ...
def __contains__(self, element: Union[Element, str]) -> bool: ...
def count(self, element: Union[Element, str]) -> int: ...
def __getitem__(self, key: int) -> Union[Element, str]: ...
class RootElement(Element):
attributes: List[Any]
children: List[Union[Element, str]]
def __init__(self) -> None: ...
class HTMLParseError(Exception): ...
class Parser(HTMLParser):
SELF_CLOSING_TAGS: Any = ...
root: Any = ...
open_tags: Any = ...
element_positions: Any = ...
def __init__(self) -> None: ...
def error(self, msg: str) -> Any: ...
def format_position(
self, position: None = ..., element: None = ...
) -> str: ...
@property
def current(self) -> Element: ...
def handle_startendtag(
self, tag: str, attrs: List[Tuple[str, Optional[str]]]
) -> None: ...
def handle_starttag(
self, tag: str, attrs: List[Tuple[str, Optional[str]]]
) -> None: ...
def handle_endtag(self, tag: str) -> None: ...
def handle_data(self, data: str) -> None: ...
def handle_charref(self, name: str) -> None: ...
def handle_entityref(self, name: str) -> None: ...
def parse_html(html: str) -> Element: ...
+172
View File
@@ -0,0 +1,172 @@
import unittest
from argparse import ArgumentParser
from typing import Any, Dict, List, Optional, Set, Tuple, Type, Union
from unittest.case import TestCase, _SubTest
from unittest.runner import TextTestResult, _WritelnDecorator
from unittest.suite import TestSuite
from django.db.backends.base.base import BaseDatabaseWrapper
from django.test.testcases import SimpleTestCase, TestCase
from django.utils.datastructures import OrderedSet
class DebugSQLTextTestResult(unittest.TextTestResult):
buffer: bool
descriptions: bool
dots: bool
errors: List[Tuple[unittest.case.TestCase, str, str]]
expectedFailures: List[Any]
failfast: bool
failures: List[Tuple[unittest.case.TestCase, str, str]]
shouldStop: bool
showAll: bool
skipped: List[Any]
stream: unittest.runner._WritelnDecorator
tb_locals: bool
testsRun: int
unexpectedSuccesses: List[Any]
logger: logging.Logger = ...
def __init__(
self, stream: _WritelnDecorator, descriptions: bool, verbosity: int
) -> None: ...
debug_sql_stream: _io.StringIO = ...
handler: logging.StreamHandler = ...
def startTest(self, test: TestCase) -> None: ...
def stopTest(self, test: TestCase) -> None: ...
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[Tuple[TestCase, str, str]]
) -> None: ...
class RemoteTestResult:
events: List[Any] = ...
failfast: bool = ...
shouldStop: bool = ...
testsRun: int = ...
def __init__(self) -> None: ...
@property
def test_index(self): ...
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: ...
def stop(self) -> None: ...
def startTestRun(self) -> None: ...
def stopTestRun(self) -> None: ...
def startTest(self, test: Any) -> None: ...
def stopTest(self, test: Any) -> None: ...
def addError(self, test: Any, err: Any) -> None: ...
def addFailure(self, test: Any, err: Any) -> None: ...
def addSubTest(self, test: Any, subtest: Any, err: Any) -> None: ...
def addSuccess(self, test: Any) -> None: ...
def addSkip(self, test: Any, reason: Any) -> None: ...
def addExpectedFailure(self, test: Any, err: Any) -> None: ...
def addUnexpectedSuccess(self, test: Any) -> None: ...
class RemoteTestRunner:
resultclass: Any = ...
failfast: Any = ...
def __init__(
self, failfast: bool = ..., resultclass: Optional[Any] = ...
) -> None: ...
def run(self, test: Any): ...
def default_test_processes() -> int: ...
class ParallelTestSuite(unittest.TestSuite):
init_worker: Any = ...
run_subsuite: Any = ...
runner_class: Any = ...
subsuites: Any = ...
processes: Any = ...
failfast: Any = ...
def __init__(
self, suite: Any, processes: Any, failfast: bool = ...
) -> None: ...
def run(self, result: Any): ...
class DiscoverRunner:
test_suite: Any = ...
parallel_test_suite: Any = ...
test_runner: Any = ...
test_loader: Any = ...
reorder_by: Any = ...
pattern: Optional[str] = ...
top_level: None = ...
verbosity: int = ...
interactive: bool = ...
failfast: bool = ...
keepdb: bool = ...
reverse: bool = ...
debug_mode: bool = ...
debug_sql: bool = ...
parallel: int = ...
tags: Set[str] = ...
exclude_tags: Set[str] = ...
def __init__(
self,
pattern: Optional[str] = ...,
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: Optional[List[str]] = ...,
**kwargs: Any
) -> None: ...
@classmethod
def add_arguments(cls, parser: ArgumentParser) -> None: ...
def setup_test_environment(self, **kwargs: Any) -> None: ...
def build_suite(
self,
test_labels: Union[List[str], Tuple[str, str]] = ...,
extra_tests: Optional[List[Any]] = ...,
**kwargs: Any
) -> TestSuite: ...
def setup_databases(
self, **kwargs: Any
) -> List[Tuple[BaseDatabaseWrapper, str, bool]]: ...
def get_resultclass(self) -> Optional[Type[DebugSQLTextTestResult]]: ...
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: List[Tuple[BaseDatabaseWrapper, 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 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 partition_suite_by_case(suite: Any): ...
def filter_tests_by_tags(
suite: TestSuite, tags: Set[str], exclude_tags: Set[str]
) -> TestSuite: ...
+23
View File
@@ -0,0 +1,23 @@
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
from django.test import LiveServerTestCase
class SeleniumTestCaseBase:
browsers: Any = ...
browser: Any = ...
def __new__(
cls: Type[SeleniumTestCaseBase],
name: str,
bases: Tuple[Type[SeleniumTestCase]],
attrs: Dict[str, Union[Callable, List[str], str]],
) -> Type[SeleniumTestCase]: ...
@classmethod
def import_webdriver(cls, browser: Any): ...
def create_webdriver(self): ...
class SeleniumTestCase(LiveServerTestCase):
implicit_wait: int = ...
@classmethod
def setUpClass(cls) -> None: ...
def disable_implicit_wait(self) -> None: ...
+20
View File
@@ -0,0 +1,20 @@
from typing import Any, Optional
template_rendered: Any
COMPLEX_OVERRIDE_SETTINGS: Any
def clear_cache_handlers(**kwargs: Any) -> None: ...
def update_installed_apps(**kwargs: Any) -> None: ...
def update_connections_time_zone(**kwargs: Any) -> None: ...
def clear_routers_cache(**kwargs: Any) -> None: ...
def reset_template_engines(**kwargs: Any) -> None: ...
def clear_serializers_cache(**kwargs: Any) -> None: ...
def language_changed(**kwargs: Any) -> None: ...
def localize_settings_changed(**kwargs: Any) -> None: ...
def file_storage_changed(**kwargs: Any) -> None: ...
def complex_setting_changed(**kwargs: Any) -> None: ...
def root_urlconf_changed(**kwargs: Any) -> None: ...
def static_storage_changed(**kwargs: Any) -> None: ...
def static_finders_changed(**kwargs: Any) -> None: ...
def auth_password_validators_changed(**kwargs: Any) -> None: ...
def user_model_swapped(**kwargs: Any) -> None: ...
+296
View File
@@ -0,0 +1,296 @@
import threading
import unittest
from contextlib import _GeneratorContextManager
from datetime import date
from typing import (Any, Callable, Dict, Iterator, List, Optional, Set, Tuple,
Type, Union)
from unittest.runner import TextTestResult
from django.core.handlers.wsgi import WSGIHandler
from django.core.servers.basehttp import WSGIRequestHandler
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.base import Model
from django.db.models.query import QuerySet, RawQuerySet
from django.forms.fields import EmailField
from django.http.response import HttpResponse, HttpResponseBase
from django.template.context import Context
from django.test.html import Element
from django.test.utils import (CaptureQueriesContext, ContextList,
modify_settings, override_settings)
from django.utils.safestring import SafeText
class _AssertNumQueriesContext(CaptureQueriesContext):
connection: django.db.backends.sqlite3.base.DatabaseWrapper
final_queries: Optional[int]
force_debug_cursor: bool
initial_queries: int
test_case: Union[
django.test.testcases.SerializeMixin,
django.test.testcases.TransactionTestCase,
] = ...
num: int = ...
def __init__(self, test_case: Any, num: Any, connection: Any) -> None: ...
def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any): ...
class _AssertTemplateUsedContext:
test_case: django.test.testcases.SimpleTestCase = ...
template_name: str = ...
rendered_templates: List[django.template.base.Template] = ...
rendered_template_names: List[str] = ...
context: django.test.utils.ContextList = ...
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 test(self): ...
def message(self): ...
def __enter__(self): ...
def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any): ...
class _AssertTemplateNotUsedContext(_AssertTemplateUsedContext):
context: django.test.utils.ContextList
rendered_template_names: List[str]
rendered_templates: List[django.template.base.Template]
template_name: str
test_case: django.test.testcases.SimpleTestCase
def test(self): ...
def message(self): ...
class _CursorFailure:
cls_name: str = ...
wrapped: Callable = ...
def __init__(self, cls_name: Any, wrapped: Any) -> None: ...
def __call__(self) -> None: ...
class SimpleTestCase(unittest.TestCase):
client_class: Any = ...
allow_database_queries: bool = ...
@classmethod
def setUpClass(cls) -> None: ...
@classmethod
def tearDownClass(cls) -> None: ...
def __call__(self, result: TextTestResult = ...) -> None: ...
def settings(self, **kwargs: Any) -> override_settings: ...
def modify_settings(self, **kwargs: Any) -> modify_settings: ...
def assertRedirects(
self,
response: HttpResponse,
expected_url: str,
status_code: int = ...,
target_status_code: int = ...,
msg_prefix: str = ...,
fetch_redirect_response: bool = ...,
) -> None: ...
def assertContains(
self,
response: HttpResponseBase,
text: Union[bytes, int, str],
count: Optional[int] = ...,
status_code: int = ...,
msg_prefix: str = ...,
html: bool = ...,
) -> None: ...
def assertNotContains(
self,
response: HttpResponse,
text: Union[bytes, str],
status_code: int = ...,
msg_prefix: str = ...,
html: bool = ...,
) -> None: ...
def assertFormError(
self,
response: HttpResponse,
form: str,
field: Optional[str],
errors: Union[List[str], str],
msg_prefix: str = ...,
) -> None: ...
def assertFormsetError(
self,
response: HttpResponse,
formset: str,
form_index: Optional[int],
field: Optional[str],
errors: Union[List[str], str],
msg_prefix: str = ...,
) -> None: ...
def assertTemplateUsed(
self,
response: Optional[Union[HttpResponse, str]] = ...,
template_name: Optional[str] = ...,
msg_prefix: str = ...,
count: Optional[int] = ...,
) -> Optional[_AssertTemplateUsedContext]: ...
def assertTemplateNotUsed(
self,
response: Union[HttpResponse, str] = ...,
template_name: Optional[str] = ...,
msg_prefix: str = ...,
) -> Optional[_AssertTemplateNotUsedContext]: ...
def assertRaisesMessage(
self,
expected_exception: Type[Exception],
expected_message: str,
*args: Any,
**kwargs: Any
) -> Optional[_GeneratorContextManager]: ...
def assertWarnsMessage(
self,
expected_warning: Type[Exception],
expected_message: str,
*args: Any,
**kwargs: Any
) -> _GeneratorContextManager: ...
def assertFieldOutput(
self,
fieldclass: Type[EmailField],
valid: Dict[str, str],
invalid: Dict[str, List[str]],
field_args: None = ...,
field_kwargs: None = ...,
empty_value: str = ...,
) -> Any: ...
def assertHTMLEqual(
self, html1: str, html2: str, msg: None = ...
) -> None: ...
def assertHTMLNotEqual(
self, html1: str, html2: str, msg: None = ...
) -> None: ...
def assertInHTML(
self,
needle: str,
haystack: SafeText,
count: Optional[int] = ...,
msg_prefix: str = ...,
) -> None: ...
def assertJSONEqual(
self,
raw: str,
expected_data: Union[Dict[str, str], bool, str],
msg: None = ...,
) -> None: ...
def assertJSONNotEqual(
self, raw: str, expected_data: str, msg: None = ...
) -> None: ...
def assertXMLEqual(self, xml1: str, xml2: str, msg: None = ...) -> None: ...
def assertXMLNotEqual(
self, xml1: str, xml2: str, msg: None = ...
) -> None: ...
class TransactionTestCase(SimpleTestCase):
reset_sequences: bool = ...
available_apps: Any = ...
fixtures: Any = ...
multi_db: bool = ...
serialized_rollback: bool = ...
allow_database_queries: bool = ...
def assertQuerysetEqual(
self,
qs: Union[Iterator[Any], List[Model], QuerySet, RawQuerySet],
values: Union[
List[None],
List[Tuple[str, str]],
List[date],
List[int],
List[str],
Set[str],
QuerySet,
],
transform: Union[Callable, Type[str]] = ...,
ordered: bool = ...,
msg: None = ...,
) -> None: ...
def assertNumQueries(
self,
num: int,
func: Optional[Union[Callable, Type[list]]] = ...,
*args: Any,
using: Any = ...,
**kwargs: Any
) -> Optional[_AssertNumQueriesContext]: ...
class TestCase(TransactionTestCase):
@classmethod
def setUpClass(cls) -> None: ...
@classmethod
def tearDownClass(cls) -> None: ...
@classmethod
def setUpTestData(cls) -> None: ...
class CheckCondition:
conditions: Tuple[Tuple[Callable, str]] = ...
def __init__(self, *conditions: Any) -> None: ...
def add_condition(
self, condition: Callable, reason: str
) -> CheckCondition: ...
def __get__(
self, instance: None, cls: Type[TransactionTestCase] = ...
) -> bool: ...
def skipIfDBFeature(*features: Any) -> Callable: ...
def skipUnlessDBFeature(*features: Any) -> Callable: ...
class QuietWSGIRequestHandler(WSGIRequestHandler):
def log_message(*args: Any) -> None: ...
class FSFilesHandler(WSGIHandler):
application: Any = ...
base_url: Any = ...
def __init__(self, application: Any) -> None: ...
def file_path(self, url: Any): ...
def get_response(self, request: Any): ...
def serve(self, request: Any): ...
def __call__(self, environ: Any, start_response: Any): ...
class _StaticFilesHandler(FSFilesHandler):
def get_base_dir(self): ...
def get_base_url(self): ...
class _MediaFilesHandler(FSFilesHandler):
def get_base_dir(self): ...
def get_base_url(self): ...
class LiveServerThread(threading.Thread):
host: str = ...
port: int = ...
is_ready: threading.Event = ...
error: Optional[django.core.exceptions.ImproperlyConfigured] = ...
static_handler: Type[django.core.handlers.wsgi.WSGIHandler] = ...
connections_override: Dict[
str, django.db.backends.sqlite3.base.DatabaseWrapper
] = ...
def __init__(
self,
host: str,
static_handler: Type[WSGIHandler],
connections_override: Dict[str, DatabaseWrapper] = ...,
port: int = ...,
) -> None: ...
httpd: django.core.servers.basehttp.ThreadedWSGIServer = ...
def run(self) -> None: ...
def terminate(self) -> None: ...
class LiveServerTestCase(TransactionTestCase):
host: str = ...
port: int = ...
server_thread_class: Any = ...
static_handler: Any = ...
def live_server_url(cls): ...
@classmethod
def setUpClass(cls) -> None: ...
@classmethod
def tearDownClass(cls) -> None: ...
class SerializeMixin:
lockfile: Any = ...
@classmethod
def setUpClass(cls) -> None: ...
@classmethod
def tearDownClass(cls) -> None: ...
+163
View File
@@ -0,0 +1,163 @@
from collections import OrderedDict
from contextlib import _GeneratorContextManager
from decimal import Decimal
from io import StringIO
from typing import (Any, Callable, Dict, Iterator, List, Optional, Set, Tuple,
Type, Union)
from django.apps.registry import Apps
from django.conf import LazySettings
from django.db import DefaultConnectionProxy
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.template.base import Template
from django.template.context import Context
from django.test.runner import DiscoverRunner
from django.test.testcases import SimpleTestCase
from django.utils.safestring import SafeText
class Approximate:
val: Union[decimal.Decimal, float] = ...
places: int = ...
def __init__(
self, val: Union[Decimal, float], places: int = ...
) -> None: ...
def __eq__(self, other: Union[Decimal, float]) -> bool: ...
class ContextList(list):
def __getitem__(self, key: Union[int, str]) -> Any: ...
def get(self, key: str, default: Optional[str] = ...) -> str: ...
def __contains__(self, key: str) -> bool: ...
def keys(self) -> Set[str]: ...
class _TestState: ...
def setup_test_environment(debug: Optional[bool] = ...) -> None: ...
def teardown_test_environment() -> None: ...
def get_runner(
settings: LazySettings, test_runner_class: Optional[str] = ...
) -> Type[DiscoverRunner]: ...
class TestContextDecorator:
attr_name: Any = ...
kwarg_name: Any = ...
def __init__(
self, attr_name: Optional[str] = ..., kwarg_name: Optional[str] = ...
) -> None: ...
def enable(self) -> None: ...
def disable(self) -> None: ...
def __enter__(self) -> Optional[Apps]: ...
def __exit__(
self, exc_type: None, exc_value: None, traceback: None
) -> None: ...
def decorate_class(
self, cls: Type[SimpleTestCase]
) -> Type[SimpleTestCase]: ...
def decorate_callable(self, func: Callable) -> Callable: ...
def __call__(
self,
decorated: Union[
Callable, Type[Union[SimpleTestCase, LoggingCaptureMixin]]
],
) -> Union[Callable, Type[Union[SimpleTestCase, LoggingCaptureMixin]]]: ...
class override_settings(TestContextDecorator):
attr_name: None
kwarg_name: None
options: Dict[str, Any] = ...
def __init__(self, **kwargs: Any) -> None: ...
wrapped: Union[django.conf.Settings, django.conf.UserSettingsHolder] = ...
def enable(self) -> None: ...
def disable(self) -> None: ...
def save_options(
self, test_func: Type[Union[SimpleTestCase, LoggingCaptureMixin]]
) -> None: ...
def decorate_class(
self, cls: Type[Union[SimpleTestCase, LoggingCaptureMixin]]
) -> Type[Union[SimpleTestCase, LoggingCaptureMixin]]: ...
class modify_settings(override_settings):
attr_name: None
kwarg_name: None
wrapped: Union[django.conf.Settings, django.conf.UserSettingsHolder]
operations: List[Tuple[str, Dict[str, Union[List[str], str]]]] = ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def save_options(self, test_func: Type[SimpleTestCase]) -> None: ...
options: Dict[str, List[Union[Tuple[str, str], str]]] = ...
def enable(self) -> None: ...
class override_system_checks(TestContextDecorator):
attr_name: None
kwarg_name: None
registry: django.core.checks.registry.CheckRegistry = ...
new_checks: List[Callable] = ...
deployment_checks: Optional[List[Callable]] = ...
def __init__(
self,
new_checks: List[Callable],
deployment_checks: Optional[List[Callable]] = ...,
) -> None: ...
old_checks: Set[Callable] = ...
old_deployment_checks: Set[Callable] = ...
def enable(self) -> None: ...
def disable(self) -> None: ...
class CaptureQueriesContext:
connection: django.db.DefaultConnectionProxy = ...
def __init__(
self, connection: Union[DefaultConnectionProxy, DatabaseWrapper]
) -> None: ...
def __iter__(self): ...
def __getitem__(self, index: int) -> Dict[str, str]: ...
def __len__(self) -> int: ...
@property
def captured_queries(self) -> List[Dict[str, str]]: ...
force_debug_cursor: bool = ...
initial_queries: int = ...
final_queries: Optional[int] = ...
def __enter__(self) -> CaptureQueriesContext: ...
def __exit__(
self, exc_type: None, exc_value: None, traceback: None
) -> None: ...
class ignore_warnings(TestContextDecorator):
attr_name: None
kwarg_name: None
ignore_kwargs: Dict[
str, Union[Type[django.utils.deprecation.RemovedInDjango30Warning], str]
] = ...
filter_func: Callable = ...
def __init__(self, **kwargs: Any) -> None: ...
catch_warnings: warnings.catch_warnings = ...
def enable(self) -> None: ...
def disable(self) -> None: ...
requires_tz_support: Any
def isolate_lru_cache(lru_cache_object: Callable) -> Iterator[None]: ...
class override_script_prefix(TestContextDecorator):
attr_name: None
kwarg_name: None
prefix: str = ...
def __init__(self, prefix: str) -> None: ...
old_prefix: str = ...
def enable(self) -> None: ...
def disable(self) -> None: ...
class LoggingCaptureMixin:
logger: Any = ...
old_stream: Any = ...
logger_output: Any = ...
def setUp(self) -> None: ...
def tearDown(self) -> None: ...
class isolate_apps(TestContextDecorator):
attr_name: Optional[str]
kwarg_name: Optional[str]
installed_apps: Tuple[str] = ...
def __init__(self, *installed_apps: Any, **kwargs: Any) -> None: ...
old_apps: django.apps.registry.Apps = ...
def enable(self) -> Apps: ...
def disable(self) -> None: ...