mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-10 14:01:56 +08:00
run black over stubs, add checking to travis
This commit is contained in:
@@ -1,9 +1,3 @@
|
||||
from .testcases import (
|
||||
TestCase as TestCase,
|
||||
TransactionTestCase as TransactionTestCase,
|
||||
SimpleTestCase as SimpleTestCase
|
||||
)
|
||||
from .testcases import TestCase as TestCase, TransactionTestCase as TransactionTestCase, SimpleTestCase as SimpleTestCase
|
||||
|
||||
from .utils import (
|
||||
override_settings as override_settings
|
||||
)
|
||||
from .utils import override_settings as override_settings
|
||||
|
||||
@@ -7,19 +7,15 @@ 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.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: ...
|
||||
def __init__(self, message: str, last_response: HttpResponseRedirect) -> None: ...
|
||||
|
||||
class FakePayload:
|
||||
read_started: bool = ...
|
||||
@@ -30,9 +26,7 @@ class FakePayload:
|
||||
|
||||
class ClientHandler(BaseHandler):
|
||||
enforce_csrf_checks: bool = ...
|
||||
def __init__(
|
||||
self, enforce_csrf_checks: bool = ..., *args: Any, **kwargs: Any
|
||||
) -> None: ...
|
||||
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: ...
|
||||
@@ -46,37 +40,17 @@ class RequestFactory:
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
self, path: str, data: Union[Dict[str, str], str] = ..., content_type: str = ..., secure: bool = ..., **extra: Any
|
||||
) -> Union[WSGIRequest, HttpResponse]: ...
|
||||
def put(
|
||||
self,
|
||||
@@ -115,15 +89,10 @@ class RequestFactory:
|
||||
class Client(RequestFactory):
|
||||
defaults: Dict[str, str]
|
||||
errors: _io.BytesIO
|
||||
json_encoder: Union[
|
||||
Type[django.core.serializers.json.DjangoJSONEncoder],
|
||||
unittest.mock.MagicMock,
|
||||
]
|
||||
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 __init__(self, enforce_csrf_checks: bool = ..., **defaults: Any) -> None: ...
|
||||
def store_exc_info(self, **kwargs: Any) -> None: ...
|
||||
@property
|
||||
def session(self) -> SessionBase: ...
|
||||
@@ -137,21 +106,10 @@ class Client(RequestFactory):
|
||||
**extra: Any
|
||||
) -> HttpResponseBase: ...
|
||||
def post(
|
||||
self,
|
||||
path: str,
|
||||
data: Any = ...,
|
||||
content_type: str = ...,
|
||||
follow: bool = ...,
|
||||
secure: bool = ...,
|
||||
**extra: Any
|
||||
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
|
||||
self, path: str, data: Optional[Union[Dict[str, str], str]] = ..., follow: bool = ..., secure: bool = ..., **extra: Any
|
||||
) -> HttpResponse: ...
|
||||
def options(
|
||||
self,
|
||||
@@ -190,12 +148,7 @@ class Client(RequestFactory):
|
||||
**extra: Any
|
||||
) -> HttpResponse: ...
|
||||
def trace(
|
||||
self,
|
||||
path: str,
|
||||
data: Union[Dict[str, str], str] = ...,
|
||||
follow: bool = ...,
|
||||
secure: bool = ...,
|
||||
**extra: Any
|
||||
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: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from html.parser import HTMLParser
|
||||
from typing import Any, List, Optional, Tuple, Union, TypeVar
|
||||
|
||||
_Self = TypeVar('_Self')
|
||||
_Self = TypeVar("_Self")
|
||||
|
||||
WHITESPACE: Any
|
||||
|
||||
@@ -11,11 +11,7 @@ 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 __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: ...
|
||||
@@ -36,17 +32,11 @@ class Parser(HTMLParser):
|
||||
element_positions: Any = ...
|
||||
def __init__(self) -> None: ...
|
||||
def error(self, msg: str) -> Any: ...
|
||||
def format_position(
|
||||
self, position: None = ..., element: None = ...
|
||||
) -> str: ...
|
||||
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_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: ...
|
||||
|
||||
@@ -9,7 +9,6 @@ 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
|
||||
@@ -26,21 +25,15 @@ class DebugSQLTextTestResult(unittest.TextTestResult):
|
||||
testsRun: int
|
||||
unexpectedSuccesses: List[Any]
|
||||
logger: logging.Logger = ...
|
||||
def __init__(
|
||||
self, stream: _WritelnDecorator, descriptions: bool, verbosity: int
|
||||
) -> None: ...
|
||||
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: ...
|
||||
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] = ...
|
||||
@@ -69,9 +62,7 @@ class RemoteTestResult:
|
||||
class RemoteTestRunner:
|
||||
resultclass: Any = ...
|
||||
failfast: Any = ...
|
||||
def __init__(
|
||||
self, failfast: bool = ..., resultclass: Optional[Any] = ...
|
||||
) -> None: ...
|
||||
def __init__(self, failfast: bool = ..., resultclass: Optional[Any] = ...) -> None: ...
|
||||
def run(self, test: Any): ...
|
||||
|
||||
def default_test_processes() -> int: ...
|
||||
@@ -83,9 +74,7 @@ class ParallelTestSuite(unittest.TestSuite):
|
||||
subsuites: Any = ...
|
||||
processes: Any = ...
|
||||
failfast: Any = ...
|
||||
def __init__(
|
||||
self, suite: Any, processes: Any, failfast: bool = ...
|
||||
) -> None: ...
|
||||
def __init__(self, suite: Any, processes: Any, failfast: bool = ...) -> None: ...
|
||||
def run(self, result: Any): ...
|
||||
|
||||
class DiscoverRunner:
|
||||
@@ -126,47 +115,22 @@ class DiscoverRunner:
|
||||
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
|
||||
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 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_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 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 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 = ...,
|
||||
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: ...
|
||||
|
||||
@@ -2,7 +2,6 @@ from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
||||
|
||||
from django.test import LiveServerTestCase
|
||||
|
||||
|
||||
class SeleniumTestCaseBase:
|
||||
browsers: Any = ...
|
||||
browser: Any = ...
|
||||
|
||||
@@ -2,8 +2,7 @@ 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 typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union
|
||||
from unittest.runner import TextTestResult
|
||||
|
||||
from django.core.handlers.wsgi import WSGIHandler
|
||||
@@ -15,20 +14,15 @@ 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.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,
|
||||
] = ...
|
||||
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): ...
|
||||
@@ -40,14 +34,7 @@ class _AssertTemplateUsedContext:
|
||||
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 on_template_render(self, sender: Any, signal: Any, template: Any, context: Any, **kwargs: Any) -> None: ...
|
||||
def test(self): ...
|
||||
def message(self): ...
|
||||
def __enter__(self): ...
|
||||
@@ -97,20 +84,10 @@ class SimpleTestCase(unittest.TestCase):
|
||||
html: bool = ...,
|
||||
) -> None: ...
|
||||
def assertNotContains(
|
||||
self,
|
||||
response: HttpResponse,
|
||||
text: Union[bytes, str],
|
||||
status_code: int = ...,
|
||||
msg_prefix: str = ...,
|
||||
html: bool = ...,
|
||||
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 = ...,
|
||||
self, response: HttpResponse, form: str, field: Optional[str], errors: Union[List[str], str], msg_prefix: str = ...
|
||||
) -> None: ...
|
||||
def assertFormsetError(
|
||||
self,
|
||||
@@ -129,24 +106,13 @@ class SimpleTestCase(unittest.TestCase):
|
||||
count: Optional[int] = ...,
|
||||
) -> Optional[_AssertTemplateUsedContext]: ...
|
||||
def assertTemplateNotUsed(
|
||||
self,
|
||||
response: Union[HttpResponse, str] = ...,
|
||||
template_name: Optional[str] = ...,
|
||||
msg_prefix: str = ...,
|
||||
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
|
||||
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
|
||||
self, expected_warning: Type[Exception], expected_message: str, *args: Any, **kwargs: Any
|
||||
) -> _GeneratorContextManager: ...
|
||||
def assertFieldOutput(
|
||||
self,
|
||||
@@ -157,32 +123,13 @@ class SimpleTestCase(unittest.TestCase):
|
||||
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 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: ...
|
||||
def assertXMLNotEqual(self, xml1: str, xml2: str, msg: None = ...) -> None: ...
|
||||
|
||||
class TransactionTestCase(SimpleTestCase):
|
||||
reset_sequences: bool = ...
|
||||
@@ -194,26 +141,13 @@ class TransactionTestCase(SimpleTestCase):
|
||||
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,
|
||||
],
|
||||
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
|
||||
self, num: int, func: Optional[Union[Callable, Type[list]]] = ..., *args: Any, using: Any = ..., **kwargs: Any
|
||||
) -> Optional[_AssertNumQueriesContext]: ...
|
||||
|
||||
class TestCase(TransactionTestCase):
|
||||
@@ -227,12 +161,8 @@ class TestCase(TransactionTestCase):
|
||||
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 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: ...
|
||||
@@ -263,9 +193,7 @@ class LiveServerThread(threading.Thread):
|
||||
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
|
||||
] = ...
|
||||
connections_override: Dict[str, django.db.backends.sqlite3.base.DatabaseWrapper] = ...
|
||||
def __init__(
|
||||
self,
|
||||
host: str,
|
||||
|
||||
@@ -2,8 +2,7 @@ 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 typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union
|
||||
|
||||
from django.apps.registry import Apps
|
||||
from django.conf import LazySettings
|
||||
@@ -16,13 +15,10 @@ 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 __init__(self, val: Union[Decimal, float], places: int = ...) -> None: ...
|
||||
def __eq__(self, other: Union[Decimal, float]) -> bool: ...
|
||||
|
||||
class ContextList(list):
|
||||
@@ -35,31 +31,20 @@ 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]: ...
|
||||
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 __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 __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]]
|
||||
],
|
||||
self, decorated: Union[Callable, Type[Union[SimpleTestCase, LoggingCaptureMixin]]]
|
||||
) -> Union[Callable, Type[Union[SimpleTestCase, LoggingCaptureMixin]]]: ...
|
||||
|
||||
class override_settings(TestContextDecorator):
|
||||
@@ -70,9 +55,7 @@ class override_settings(TestContextDecorator):
|
||||
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 save_options(self, test_func: Type[Union[SimpleTestCase, LoggingCaptureMixin]]) -> None: ...
|
||||
def decorate_class(
|
||||
self, cls: Type[Union[SimpleTestCase, LoggingCaptureMixin]]
|
||||
) -> Type[Union[SimpleTestCase, LoggingCaptureMixin]]: ...
|
||||
@@ -93,11 +76,7 @@ class override_system_checks(TestContextDecorator):
|
||||
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: ...
|
||||
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: ...
|
||||
@@ -105,9 +84,7 @@ class override_system_checks(TestContextDecorator):
|
||||
|
||||
class CaptureQueriesContext:
|
||||
connection: django.db.DefaultConnectionProxy = ...
|
||||
def __init__(
|
||||
self, connection: Union[DefaultConnectionProxy, DatabaseWrapper]
|
||||
) -> None: ...
|
||||
def __init__(self, connection: Union[DefaultConnectionProxy, DatabaseWrapper]) -> None: ...
|
||||
def __iter__(self): ...
|
||||
def __getitem__(self, index: int) -> Dict[str, str]: ...
|
||||
def __len__(self) -> int: ...
|
||||
@@ -117,16 +94,12 @@ class CaptureQueriesContext:
|
||||
initial_queries: int = ...
|
||||
final_queries: Optional[int] = ...
|
||||
def __enter__(self) -> CaptureQueriesContext: ...
|
||||
def __exit__(
|
||||
self, exc_type: None, exc_value: None, traceback: None
|
||||
) -> None: ...
|
||||
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]
|
||||
] = ...
|
||||
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 = ...
|
||||
|
||||
Reference in New Issue
Block a user