mirror of
https://github.com/davidhalter/django-stubs.git
synced 2026-10-23 22:37:10 +08:00
merge with stubgen output
This commit is contained in:
1 parent
496a6274e7
commit
4866354600
294 files changed
+10234
-10842
No files matched your search
+167
-70
@@ -1,85 +1,182 @@
|
||||
# Stubs for django.test.testcases (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
import threading
|
||||
import unittest
|
||||
from django.core.handlers.wsgi import WSGIHandler
|
||||
from django.core.servers.basehttp import WSGIRequestHandler
|
||||
from django.test.utils import CaptureQueriesContext
|
||||
from typing import Any, Optional
|
||||
|
||||
from contextlib import _GeneratorContextManager
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
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 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 = ...
|
||||
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: Any = ...
|
||||
template_name: Any = ...
|
||||
rendered_templates: Any = ...
|
||||
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 test(self): ...
|
||||
def message(self): ...
|
||||
def __enter__(self): ...
|
||||
def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any): ...
|
||||
|
||||
class _AssertTemplateNotUsedContext(_AssertTemplateUsedContext):
|
||||
def test(self): ...
|
||||
def message(self): ...
|
||||
|
||||
class _CursorFailure:
|
||||
cls_name: Any = ...
|
||||
wrapped: Any = ...
|
||||
def __init__(self, cls_name: Any, wrapped: Any) -> None: ...
|
||||
def __call__(self) -> None: ...
|
||||
|
||||
class SimpleTestCase(unittest.TestCase):
|
||||
client_class: Any = ...
|
||||
_overridden_settings: Any = ...
|
||||
_modified_settings: Any = ...
|
||||
allow_database_queries: bool = ...
|
||||
@classmethod
|
||||
def setUpClass(cls) -> None: ...
|
||||
@classmethod
|
||||
def tearDownClass(cls) -> None: ...
|
||||
def __call__(self, result: TextTestResult = ...) -> None: ...
|
||||
client: Any = ...
|
||||
def _pre_setup(self) -> None: ...
|
||||
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 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 assertXMLEqual(self, xml1: Any, xml2: Any, msg: Optional[Any] = ...) -> None: ...
|
||||
def assertXMLNotEqual(self, xml1: Any, xml2: Any, msg: Optional[Any] = ...) -> None: ...
|
||||
|
||||
class TransactionTestCase(SimpleTestCase):
|
||||
reset_sequences: bool = ...
|
||||
available_apps: Any = ...
|
||||
fixtures: Any = ...
|
||||
multi_db: bool = ...
|
||||
serialized_rollback: bool = ...
|
||||
allow_database_queries: bool = ...
|
||||
def _pre_setup(self) -> None: ...
|
||||
@classmethod
|
||||
def _databases_names(cls, include_mirrors: bool = ...): ...
|
||||
def _reset_sequences(self, db_name: Any) -> None: ...
|
||||
def _fixture_setup(self) -> None: ...
|
||||
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): ...
|
||||
|
||||
class TestCase(TransactionTestCase):
|
||||
@classmethod
|
||||
def _enter_atomics(cls): ...
|
||||
@classmethod
|
||||
def _rollback_atomics(cls, atomics: Any) -> None: ...
|
||||
@classmethod
|
||||
def setUpClass(cls): ...
|
||||
@classmethod
|
||||
def tearDownClass(cls) -> None: ...
|
||||
@classmethod
|
||||
def setUpTestData(cls) -> None: ...
|
||||
def _should_reload_connections(self): ...
|
||||
atomics: Any = ...
|
||||
def _fixture_setup(self): ...
|
||||
def _fixture_teardown(self): ...
|
||||
def _should_check_constraints(self, connection: Any): ...
|
||||
|
||||
class CheckCondition:
|
||||
conditions: Any = ...
|
||||
def __init__(self, *conditions: Any) -> None: ...
|
||||
def add_condition(self, condition: Any, reason: Any): ...
|
||||
def __get__(self, instance: None, cls: Type[TestCase] = ...) -> bool: ...
|
||||
def __init__(self, *conditions) -> None: ...
|
||||
|
||||
def skipIfDBFeature(*features: Any): ...
|
||||
def skipUnlessDBFeature(*features: Any): ...
|
||||
|
||||
class LiveServerTestCase:
|
||||
class QuietWSGIRequestHandler(WSGIRequestHandler):
|
||||
def log_message(*args: Any) -> None: ...
|
||||
|
||||
class FSFilesHandler(WSGIHandler):
|
||||
application: Any = ...
|
||||
base_url: Any = ...
|
||||
def __init__(self, application: Any) -> None: ...
|
||||
def _should_handle(self, path: Any): ...
|
||||
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: Any = ...
|
||||
port: Any = ...
|
||||
is_ready: Any = ...
|
||||
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: ...
|
||||
httpd: Any = ...
|
||||
def run(self) -> None: ...
|
||||
def _create_server(self): ...
|
||||
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 _create_server_thread(
|
||||
cls,
|
||||
connections_override: Dict[str, DatabaseWrapper]
|
||||
) -> LiveServerThread: ...
|
||||
def setUpClass(cls) -> None: ...
|
||||
@classmethod
|
||||
def _create_server_thread(cls, connections_override: Dict[str, DatabaseWrapper]) -> LiveServerThread: ...
|
||||
@classmethod
|
||||
def _tearDownClassInternal(cls) -> None: ...
|
||||
@classmethod
|
||||
def tearDownClass(cls) -> None: ...
|
||||
|
||||
|
||||
class LiveServerThread:
|
||||
def __init__(
|
||||
self,
|
||||
host: str,
|
||||
static_handler: Type[_StaticFilesHandler],
|
||||
connections_override: Dict[str, DatabaseWrapper] = ...,
|
||||
port: int = ...
|
||||
) -> None: ...
|
||||
def terminate(self) -> None: ...
|
||||
|
||||
|
||||
class SimpleTestCase:
|
||||
def __call__(self, result: TextTestResult = ...) -> None: ...
|
||||
def _assertFooMessage(
|
||||
self,
|
||||
func: Callable,
|
||||
cm_attr: str,
|
||||
expected_exception: Type[Exception],
|
||||
expected_message: str,
|
||||
*args,
|
||||
**kwargs
|
||||
) -> _GeneratorContextManager: ...
|
||||
def _assert_contains(
|
||||
self,
|
||||
response: HttpResponseBase,
|
||||
text: Union[str, bytes, int],
|
||||
status_code: int,
|
||||
msg_prefix: str,
|
||||
html: bool
|
||||
) -> Tuple[str, int, 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 _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 _post_teardown(self) -> None: ...
|
||||
class SerializeMixin:
|
||||
lockfile: Any = ...
|
||||
@classmethod
|
||||
def setUpClass(cls) -> None: ...
|
||||
@classmethod
|
||||
def tearDownClass(cls) -> None: ...
|
||||
Reference in new issue
Block a user