mirror of
https://github.com/davidhalter/django-stubs.git
synced 2026-02-28 12:32:21 +08:00
Bump mypy 0.950 (#939)
* Bump mypy to 0.95x * Remove the * for inferred types There was an upstream change (https://github.com/python/mypy/pull/12459) to remove * from inferred types in the reveal_type output. As we are asserting the * to exist, all the test cases are now failing on the 0.950 release. Removing the expected * to mirror the upstream behaviour change should resolve the test failures.
This commit is contained in:
@@ -46,11 +46,11 @@
|
||||
|
||||
class MyCreateView(CreateView[Article, ArticleModelForm]):
|
||||
def some(self) -> None:
|
||||
reveal_type(self.get_form_class()) # N: Revealed type is "Type[main.ArticleModelForm*]"
|
||||
reveal_type(self.get_form_class()) # N: Revealed type is "Type[main.ArticleModelForm]"
|
||||
|
||||
class MyUpdateView(UpdateView[Article, ArticleModelForm]):
|
||||
def some(self) -> None:
|
||||
reveal_type(self.get_form_class()) # N: Revealed type is "Type[main.ArticleModelForm*]"
|
||||
reveal_type(self.get_form_class()) # N: Revealed type is "Type[main.ArticleModelForm]"
|
||||
installed_apps:
|
||||
- myapp
|
||||
files:
|
||||
@@ -79,7 +79,7 @@
|
||||
|
||||
class MyCreateView(CreateView[Article, ArticleModelForm]):
|
||||
def some(self) -> None:
|
||||
reveal_type(self.get_form()) # N: Revealed type is "main.ArticleModelForm*"
|
||||
reveal_type(self.get_form()) # N: Revealed type is "main.ArticleModelForm"
|
||||
reveal_type(self.get_form(SubArticleModelForm)) # N: Revealed type is "main.SubArticleModelForm"
|
||||
reveal_type(self.get_form(AnotherArticleModelForm)) # N: Revealed type is "main.AnotherArticleModelForm" # E: Argument 1 to "get_form" of "FormMixin" has incompatible type "Type[AnotherArticleModelForm]"; expected "Optional[Type[ArticleModelForm]]"
|
||||
installed_apps:
|
||||
|
||||
@@ -24,25 +24,25 @@
|
||||
|
||||
def empty_response(request: HttpRequest) -> HttpResponse:
|
||||
response = HttpResponse()
|
||||
reveal_type(response.content) # N: Revealed type is "builtins.bytes*"
|
||||
reveal_type(response.content) # N: Revealed type is "builtins.bytes"
|
||||
return response
|
||||
|
||||
def str_response(request: HttpRequest) -> HttpResponse:
|
||||
response = HttpResponse()
|
||||
response.content = 'It works!'
|
||||
reveal_type(response.content) # N: Revealed type is "builtins.bytes*"
|
||||
reveal_type(response.content) # N: Revealed type is "builtins.bytes"
|
||||
return response
|
||||
|
||||
def bytes_response(request: HttpRequest) -> HttpResponse:
|
||||
response = HttpResponse()
|
||||
response.content = b'It works!'
|
||||
reveal_type(response.content) # N: Revealed type is "builtins.bytes*"
|
||||
reveal_type(response.content) # N: Revealed type is "builtins.bytes"
|
||||
return response
|
||||
|
||||
def object_response(request: HttpRequest) -> HttpResponse:
|
||||
response = HttpResponse()
|
||||
response.content = _('It works!')
|
||||
reveal_type(response.content) # N: Revealed type is "builtins.bytes*"
|
||||
reveal_type(response.content) # N: Revealed type is "builtins.bytes"
|
||||
return response
|
||||
|
||||
- case: streaming_http_response
|
||||
@@ -74,29 +74,29 @@
|
||||
|
||||
def empty_response(request: HttpRequest) -> StreamingHttpResponse:
|
||||
response = StreamingHttpResponse()
|
||||
reveal_type(response.streaming_content) # N: Revealed type is "typing.Iterator*[builtins.bytes]"
|
||||
reveal_type(response.streaming_content) # N: Revealed type is "typing.Iterator[builtins.bytes]"
|
||||
return response
|
||||
|
||||
def str_response(request: HttpRequest) -> StreamingHttpResponse:
|
||||
response = StreamingHttpResponse()
|
||||
response.streaming_content = ['It works!']
|
||||
reveal_type(response.streaming_content) # N: Revealed type is "typing.Iterator*[builtins.bytes]"
|
||||
reveal_type(response.streaming_content) # N: Revealed type is "typing.Iterator[builtins.bytes]"
|
||||
return response
|
||||
|
||||
def bytes_response(request: HttpRequest) -> StreamingHttpResponse:
|
||||
response = StreamingHttpResponse()
|
||||
response.streaming_content = [b'It works!']
|
||||
reveal_type(response.streaming_content) # N: Revealed type is "typing.Iterator*[builtins.bytes]"
|
||||
reveal_type(response.streaming_content) # N: Revealed type is "typing.Iterator[builtins.bytes]"
|
||||
return response
|
||||
|
||||
def object_response(request: HttpRequest) -> StreamingHttpResponse:
|
||||
response = StreamingHttpResponse()
|
||||
response.streaming_content = [_('It works!')]
|
||||
reveal_type(response.streaming_content) # N: Revealed type is "typing.Iterator*[builtins.bytes]"
|
||||
reveal_type(response.streaming_content) # N: Revealed type is "typing.Iterator[builtins.bytes]"
|
||||
return response
|
||||
|
||||
def mixed_response(request: HttpRequest) -> StreamingHttpResponse:
|
||||
response = StreamingHttpResponse()
|
||||
response.streaming_content = [_('Yes'), '/', _('No')]
|
||||
reveal_type(response.streaming_content) # N: Revealed type is "typing.Iterator*[builtins.bytes]"
|
||||
reveal_type(response.streaming_content) # N: Revealed type is "typing.Iterator[builtins.bytes]"
|
||||
return response
|
||||
|
||||
Reference in New Issue
Block a user