mirror of
https://github.com/davidhalter/django-stubs.git
synced 2026-10-25 23:27:38 +08:00
fixes for ci imports failures
This commit is contained in:
1 parent
5ba0bbe0b7
commit
98e60d084f
84 files changed
+449
-1383
No files matched your search
@@ -6,3 +6,5 @@ from .testcases import (
|
||||
)
|
||||
|
||||
from .utils import override_settings as override_settings
|
||||
|
||||
from .client import Client as Client
|
||||
@@ -7,7 +7,7 @@ from django.core.handlers.base import BaseHandler
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.core.serializers.json import DjangoJSONEncoder
|
||||
from django.http.cookie import SimpleCookie
|
||||
from django.http.response import HttpResponse, HttpResponseBase
|
||||
from django.http.response import HttpResponseBase
|
||||
|
||||
class RedirectCycleError(Exception):
|
||||
last_response: HttpResponseBase = ...
|
||||
@@ -79,31 +79,6 @@ class Client(RequestFactory):
|
||||
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: Any = ..., 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: Any = ..., follow: bool = ..., secure: bool = ..., **extra: Any
|
||||
) -> HttpResponse: ...
|
||||
def options(
|
||||
self, path: str, data: Any = ..., content_type: str = ..., follow: bool = ..., secure: bool = ..., **extra: Any
|
||||
) -> HttpResponse: ...
|
||||
def put(
|
||||
self, path: str, data: Any = ..., content_type: str = ..., follow: bool = ..., secure: bool = ..., **extra: Any
|
||||
) -> HttpResponse: ...
|
||||
def patch(
|
||||
self, path: str, data: Any = ..., content_type: str = ..., follow: bool = ..., secure: bool = ..., **extra: Any
|
||||
) -> HttpResponse: ...
|
||||
def delete(
|
||||
self, path: str, data: Any = ..., content_type: str = ..., follow: bool = ..., secure: bool = ..., **extra: Any
|
||||
) -> HttpResponse: ...
|
||||
def trace(
|
||||
self, path: str, data: Any = ..., follow: bool = ..., secure: bool = ..., **extra: Any
|
||||
) -> HttpResponse: ...
|
||||
def login(self, **credentials: Any) -> bool: ...
|
||||
def force_login(self, user: User, backend: Optional[str] = ...) -> None: ...
|
||||
cookies: SimpleCookie = ...
|
||||
|
||||
@@ -1,38 +1,33 @@
|
||||
import unittest
|
||||
import logging
|
||||
from argparse import ArgumentParser
|
||||
from io import StringIO
|
||||
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 unittest import TestCase, TextTestResult, 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):
|
||||
class DebugSQLTextTestResult(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 = ...
|
||||
def __init__(self, stream: Any, descriptions: bool, verbosity: int) -> None: ...
|
||||
debug_sql_stream: 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:
|
||||
@@ -67,7 +62,7 @@ class RemoteTestRunner:
|
||||
|
||||
def default_test_processes() -> int: ...
|
||||
|
||||
class ParallelTestSuite(unittest.TestSuite):
|
||||
class ParallelTestSuite(TestSuite):
|
||||
init_worker: Any = ...
|
||||
run_subsuite: Any = ...
|
||||
runner_class: Any = ...
|
||||
|
||||
@@ -1,9 +1,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 unittest.runner import TextTestResult
|
||||
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.core.handlers.wsgi import WSGIHandler
|
||||
@@ -62,9 +60,9 @@ class SimpleTestCase(unittest.TestCase):
|
||||
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 __call__(self, result: unittest.TestResult = ...) -> None: ...
|
||||
def settings(self, **kwargs: Any) -> Any: ...
|
||||
def modify_settings(self, **kwargs: Any) -> Any: ...
|
||||
def assertRedirects(
|
||||
self,
|
||||
response: HttpResponse,
|
||||
@@ -120,10 +118,10 @@ class SimpleTestCase(unittest.TestCase):
|
||||
) -> Optional[_AssertTemplateNotUsedContext]: ...
|
||||
def assertRaisesMessage(
|
||||
self, expected_exception: Type[Exception], expected_message: str, *args: Any, **kwargs: Any
|
||||
) -> Optional[_GeneratorContextManager]: ...
|
||||
) -> Any: ...
|
||||
def assertWarnsMessage(
|
||||
self, expected_warning: Type[Exception], expected_message: str, *args: Any, **kwargs: Any
|
||||
) -> _GeneratorContextManager: ...
|
||||
) -> Any: ...
|
||||
def assertFieldOutput(
|
||||
self,
|
||||
fieldclass: Type[EmailField],
|
||||
|
||||
+12
-39
@@ -8,18 +8,18 @@ from django.core.checks.registry import CheckRegistry
|
||||
from django.test.runner import DiscoverRunner
|
||||
from django.test.testcases import SimpleTestCase
|
||||
|
||||
from django.conf import LazySettings
|
||||
from django.conf import LazySettings, Settings
|
||||
|
||||
_TestClass = Type[SimpleTestCase]
|
||||
_DecoratedTest = Union[Callable, _TestClass]
|
||||
|
||||
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: ...
|
||||
@@ -29,53 +29,38 @@ 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 = ...
|
||||
attr_name: Optional[str] = ...
|
||||
kwarg_name: Optional[str] = ...
|
||||
def __init__(self, attr_name: Optional[str] = ..., kwarg_name: Optional[str] = ...) -> None: ...
|
||||
def enable(self) -> None: ...
|
||||
def enable(self) -> Any: ...
|
||||
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_class(self, cls: _TestClass) -> _TestClass: ...
|
||||
def decorate_callable(self, func: Callable) -> Callable: ...
|
||||
def __call__(
|
||||
self, decorated: Union[Callable, Type[Union[SimpleTestCase, LoggingCaptureMixin]]]
|
||||
) -> Union[Callable, Type[Union[SimpleTestCase, LoggingCaptureMixin]]]: ...
|
||||
def __call__(self, decorated: _DecoratedTest) -> _DecoratedTest: ...
|
||||
|
||||
class override_settings(TestContextDecorator):
|
||||
attr_name: None
|
||||
kwarg_name: None
|
||||
options: Dict[str, Any] = ...
|
||||
def __init__(self, **kwargs: Any) -> None: ...
|
||||
wrapped: Settings = ...
|
||||
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]]: ...
|
||||
def save_options(self, test_func: _DecoratedTest) -> None: ...
|
||||
def decorate_class(self, cls: type) -> type: ...
|
||||
|
||||
class modify_settings(override_settings):
|
||||
attr_name: None
|
||||
kwarg_name: None
|
||||
wrapped: Settings
|
||||
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: ...
|
||||
def save_options(self, test_func: _DecoratedTest) -> 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: 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: Any = ...
|
||||
@@ -92,27 +77,19 @@ class 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, Any] = ...
|
||||
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 = ...
|
||||
@@ -122,10 +99,6 @@ class LoggingCaptureMixin:
|
||||
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: Apps = ...
|
||||
def enable(self) -> Apps: ...
|
||||
def disable(self) -> None: ...
|
||||
Reference in new issue
Block a user