add test_views test folder

This commit is contained in:
Maxim Kurnikov
2019-02-03 19:51:17 +03:00
parent d03fddd96d
commit 5f6b4bfd30
5 changed files with 34 additions and 31 deletions

View File

@@ -1,4 +1,4 @@
from typing import Any, Callable, Dict, List, Optional, Type, Union
from typing import Any, Callable, Dict, List, Optional, Type, Union, Sequence
from django.db.models import Manager, QuerySet
from django.db.models.base import Model
@@ -15,7 +15,7 @@ def render_to_response(
) -> HttpResponse: ...
def render(
request: HttpRequest,
template_name: str,
template_name: Union[str, Sequence[str]],
context: Optional[Dict[str, Any]] = ...,
content_type: Optional[str] = ...,
status: Optional[int] = ...,

View File

@@ -1,25 +1,18 @@
import logging.config
from logging import LogRecord
from typing import Any, Callable, Dict, List, Optional, Union
from typing import Any, Callable, Dict, Optional
from django.core.mail.backends.locmem import EmailBackend
from django.core.management.color import Style
request_logger: Any
DEFAULT_LOGGING: Any
def configure_logging(
logging_config: str, logging_settings: Dict[str, Union[Dict[str, Dict[str, Union[List[str], bool, str]]], int]]
) -> None: ...
def configure_logging(logging_config: str, logging_settings: Dict[str, Any]) -> None: ...
class AdminEmailHandler(logging.Handler):
filters: List[django.utils.log.RequireDebugFalse]
formatter: None
level: int
lock: _thread.RLock
include_html: bool = ...
email_backend: Optional[str] = ...
def __init__(self, include_html: bool = ..., email_backend: None = ...) -> None: ...
def emit(self, record: LogRecord) -> None: ...
def __init__(self, include_html: bool = ..., email_backend: Optional[str] = ...) -> None: ...
def send_mail(self, subject: str, message: str, *args: Any, **kwargs: Any) -> None: ...
def connection(self) -> EmailBackend: ...
def format_subject(self, subject: str) -> str: ...
@@ -27,23 +20,14 @@ class AdminEmailHandler(logging.Handler):
class CallbackFilter(logging.Filter):
callback: Callable = ...
def __init__(self, callback: Callable) -> None: ...
def filter(self, record: str) -> int: ...
class RequireDebugFalse(logging.Filter):
name: str
nlen: int
def filter(self, record: Union[LogRecord, str]) -> bool: ...
class RequireDebugTrue(logging.Filter):
name: str
nlen: int
def filter(self, record: Union[LogRecord, str]) -> bool: ...
class RequireDebugFalse(logging.Filter): ...
class RequireDebugTrue(logging.Filter): ...
class ServerFormatter(logging.Formatter):
datefmt: None
style: django.core.management.color.Style = ...
style: Style = ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def format(self, record: LogRecord) -> str: ...
def uses_server_time(self) -> bool: ...
def log_response(

View File

@@ -1,4 +1,6 @@
from importlib.abc import SourceLoader
from typing import Any, Callable, Dict, List, Optional, Type, Union
from types import TracebackType
from django.core.handlers.wsgi import WSGIRequest
from django.http.request import QueryDict
@@ -16,8 +18,8 @@ class CallableSettingWrapper:
def cleanse_setting(key: Union[int, str], value: Any) -> Any: ...
def get_safe_settings() -> Dict[str, Any]: ...
def technical_500_response(request: Any, exc_type: Any, exc_value: Any, tb: Any, status_code: int = ...): ...
def get_default_exception_reporter_filter() -> SafeExceptionReporterFilter: ...
def get_exception_reporter_filter(request: Optional[WSGIRequest]) -> SafeExceptionReporterFilter: ...
def get_default_exception_reporter_filter() -> ExceptionReporterFilter: ...
def get_exception_reporter_filter(request: Optional[WSGIRequest]) -> ExceptionReporterFilter: ...
class ExceptionReporterFilter:
def get_post_parameters(self, request: Any): ...
@@ -32,7 +34,7 @@ class SafeExceptionReporterFilter(ExceptionReporterFilter):
class ExceptionReporter:
request: Optional[WSGIRequest] = ...
filter: django.views.debug.SafeExceptionReporterFilter = ...
filter: ExceptionReporterFilter = ...
exc_type: None = ...
exc_value: Optional[str] = ...
tb: None = ...
@@ -41,12 +43,25 @@ class ExceptionReporter:
template_does_not_exist: bool = ...
postmortem: None = ...
def __init__(
self, request: Optional[WSGIRequest], exc_type: None, exc_value: Optional[str], tb: None, is_email: bool = ...
self,
request: Optional[WSGIRequest],
exc_type: Optional[Type[BaseException]],
exc_value: Optional[Union[str, BaseException]],
tb: Optional[TracebackType],
is_email: bool = ...,
) -> None: ...
def get_traceback_data(self) -> Dict[str, Any]: ...
def get_traceback_html(self) -> SafeText: ...
def get_traceback_text(self) -> SafeText: ...
def get_traceback_frames(self) -> List[Any]: ...
def _get_lines_from_file(
self,
filename: str,
lineno: int,
context_lines: int,
loader: Optional[SourceLoader] = ...,
module_name: Optional[str] = None,
): ...
def technical_404_response(request: WSGIRequest, exception: Http404) -> HttpResponse: ...
def default_urlconf(request: WSGIRequest) -> HttpResponse: ...

View File

@@ -9,4 +9,4 @@ DEFAULT_DIRECTORY_INDEX_TEMPLATE: str
template_translatable: Any
def directory_index(path: Any, fullpath: Any): ...
def was_modified_since(header: None = ..., mtime: float = ..., size: int = ...) -> bool: ...
def was_modified_since(header: Optional[str] = ..., mtime: float = ..., size: int = ...) -> bool: ...

View File

@@ -125,6 +125,10 @@ IGNORED_ERRORS = {
],
'select_related_onetoone': [
'"None" has no attribute'
],
'view_tests': [
'"Handler" has no attribute "include_html"',
'"EmailMessage" has no attribute "alternatives"'
]
}
# Test folders to typecheck
@@ -330,7 +334,7 @@ TESTS_DIRS = [
# TODO: 'validation',
'validators',
'version',
# TODO: 'view_tests',
'view_tests',
# TODO: 'wsgi',
]