mirror of
https://github.com/davidhalter/django-stubs.git
synced 2026-02-22 17:48:31 +08:00
fix tests for mypy 0.900 (#641)
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
from django.contrib.auth.decorators import login_required
|
||||
@method_decorator(login_required, name='dispatch')
|
||||
class TestView(View): ...
|
||||
reveal_type(TestView()) # N: Revealed type is 'main.TestView'
|
||||
reveal_type(TestView()) # N: Revealed type is "main.TestView"
|
||||
- case: method_decorator_function
|
||||
main: |
|
||||
from django.views.generic.base import View
|
||||
@@ -17,4 +17,4 @@
|
||||
@method_decorator(login_required)
|
||||
def dispatch(self, request: HttpRequest, *args, **kwargs) -> HttpResponseBase:
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
reveal_type(dispatch) # N: Revealed type is 'def (self: main.TestView, request: django.http.request.HttpRequest, *args: Any, **kwargs: Any) -> django.http.response.HttpResponseBase'
|
||||
reveal_type(dispatch) # N: Revealed type is "def (self: main.TestView, request: django.http.request.HttpRequest, *args: Any, **kwargs: Any) -> django.http.response.HttpResponseBase"
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
@cached_property
|
||||
def attr(self) -> List[str]: ...
|
||||
|
||||
reveal_type(attr) # N: Revealed type is 'django.utils.functional.cached_property[builtins.list*[builtins.str]]'
|
||||
reveal_type(attr.name) # N: Revealed type is 'builtins.str'
|
||||
reveal_type(attr) # N: Revealed type is "django.utils.functional.cached_property[builtins.list*[builtins.str]]"
|
||||
reveal_type(attr.name) # N: Revealed type is "builtins.str"
|
||||
|
||||
reveal_type(Foo.attr) # N: Revealed type is 'django.utils.functional.cached_property[builtins.list*[builtins.str]]'
|
||||
reveal_type(Foo.attr.func) # N: Revealed type is 'def (*Any, **Any) -> builtins.list*[builtins.str]'
|
||||
reveal_type(Foo.attr) # N: Revealed type is "django.utils.functional.cached_property[builtins.list*[builtins.str]]"
|
||||
reveal_type(Foo.attr.func) # N: Revealed type is "def (*Any, **Any) -> builtins.list*[builtins.str]"
|
||||
|
||||
f = Foo()
|
||||
reveal_type(f.attr) # N: Revealed type is 'builtins.list*[builtins.str]'
|
||||
reveal_type(f.attr) # N: Revealed type is "builtins.list*[builtins.str]"
|
||||
f.attr.name # E: "List[str]" has no attribute "name"
|
||||
|
||||
Reference in New Issue
Block a user