fix tests for mypy 0.900 (#641)

This commit is contained in:
Cesar Canassa
2021-06-12 00:05:46 +02:00
committed by GitHub
parent 47f1700a8b
commit 77f9926ce1
33 changed files with 370 additions and 369 deletions

View File

@@ -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"

View File

@@ -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"