Skip to content

Commit b9ada1d

Browse files
committed
Update more tests
1 parent 07704b1 commit b9ada1d

File tree

8 files changed

+12
-12
lines changed

8 files changed

+12
-12
lines changed

tests/typecheck/contrib/admin/test_options.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
pass
148148
149149
class A(admin.ModelAdmin):
150-
actions = [an_action] # E: List item 0 has incompatible type "Callable[[None], None]"; expected "Union[Callable[[Any, HttpRequest, _QuerySet[Any, Any]], Optional[HttpResponseBase]], str]" [list-item]
150+
actions = [an_action] # E: List item 0 has incompatible type "Callable[[None], None]"; expected "Union[Callable[[Any, HttpRequest, QuerySet[Any, Any]], Optional[HttpResponseBase]], str]" [list-item]
151151
- case: errors_for_invalid_model_admin_generic
152152
main: |
153153
from django.contrib.admin import ModelAdmin

tests/typecheck/contrib/sitemaps/test_generic_sitemap.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
main:26: error: Argument 1 of "location" is incompatible with supertype "Sitemap"; supertype defines the argument type as "Offer" [override]
5050
main:26: note: This violates the Liskov substitution principle
5151
main:26: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
52-
main:40: error: Argument 1 to "GenericSitemap" has incompatible type "Dict[str, List[int]]"; expected "Mapping[str, Union[datetime, _QuerySet[Offer, Offer], str]]" [arg-type]
52+
main:40: error: Argument 1 to "GenericSitemap" has incompatible type "Dict[str, List[int]]"; expected "Mapping[str, Union[datetime, QuerySet[Offer, Offer], str]]" [arg-type]
5353
5454
installed_apps:
5555
- myapp

tests/typecheck/managers/querysets/test_annotate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@
227227
return qs.annotate(foo=F('id'))
228228
229229
def add_wrong_annotation(qs: QuerySet[User]) -> QuerySet[WithAnnotations[User, FooDict]]:
230-
return qs.annotate(bar=F('id')) # E: Incompatible return value type (got "_QuerySet[WithAnnotations[myapp__models__User, TypedDict({'bar': Any})], WithAnnotations[myapp__models__User, TypedDict({'bar': Any})]]", expected "_QuerySet[WithAnnotations[myapp__models__User, TypedDict('main.FooDict', {'foo': builtins.str})], WithAnnotations[myapp__models__User, TypedDict('main.FooDict', {'foo': builtins.str})]]") [return-value]
230+
return qs.annotate(bar=F('id')) # E: Incompatible return value type (got "QuerySet[WithAnnotations[myapp__models__User, TypedDict({'bar': Any})], WithAnnotations[myapp__models__User, TypedDict({'bar': Any})]]", expected "QuerySet[WithAnnotations[myapp__models__User, TypedDict('main.FooDict', {'foo': builtins.str})], WithAnnotations[myapp__models__User, TypedDict('main.FooDict', {'foo': builtins.str})]]") [return-value]
231231
232232
qs = add_annotation(qs)
233233
qs.get().foo

tests/typecheck/managers/querysets/test_from_queryset.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,6 @@
812812
reveal_type(Manager[models.Model].from_queryset(NonQSGeneric[int]))
813813
out: |
814814
main:12: note: Revealed type is "Type[django.db.models.manager.Manager[django.db.models.base.Model]]"
815-
main:12: error: Argument 1 to "from_queryset" of "BaseManager" has incompatible type "<typing special form>"; expected "Type[_QuerySet[Model, Model]]" [arg-type]
815+
main:12: error: Argument 1 to "from_queryset" of "BaseManager" has incompatible type "<typing special form>"; expected "Type[QuerySet[Model, Model]]" [arg-type]
816816
main:17: note: Revealed type is "Type[django.db.models.manager.Manager[django.db.models.base.Model]]"
817-
main:17: error: Argument 1 to "from_queryset" of "BaseManager" has incompatible type "Type[NonQSGeneric[Any]]"; expected "Type[_QuerySet[Model, Model]]" [arg-type]
817+
main:17: error: Argument 1 to "from_queryset" of "BaseManager" has incompatible type "Type[NonQSGeneric[Any]]"; expected "Type[QuerySet[Model, Model]]" [arg-type]

tests/typecheck/managers/querysets/test_querysetany.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
user_querysets: List[QuerySet[User]] = []
3232
user_querysets.append(queryset_instance)
3333
user_querysets.append(queryset)
34-
user_querysets.append(queryset_book) # E: Argument 1 to "append" of "list" has incompatible type "_QuerySet[Book, Book]"; expected "_QuerySet[User, User]" [arg-type]
34+
user_querysets.append(queryset_book) # E: Argument 1 to "append" of "list" has incompatible type "QuerySet[Book, Book]"; expected "QuerySet[User, User]" [arg-type]
3535
installed_apps:
3636
- myapp
3737
files:

tests/typecheck/test_forms.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
queryset=Article.objects.none(),
9898
)
9999
best_category = ArticleChoiceField(
100-
queryset=Category.objects.none(), # E: Argument "queryset" to "ArticleChoiceField" has incompatible type "_QuerySet[Category, Category]"; expected "Union[Manager[Article], _QuerySet[Article, Article], None]" [arg-type]
100+
queryset=Category.objects.none(), # E: Argument "queryset" to "ArticleChoiceField" has incompatible type "QuerySet[Category, Category]"; expected "Union[Manager[Article], QuerySet[Article, Article], None]" [arg-type]
101101
)
102102
installed_apps:
103103
- myapp

tests/typecheck/views/generic/test_detail.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@
5050
...
5151
out: |
5252
main:7: error: Incompatible types in assignment (expression has type "Type[MyModel]", base class "SingleObjectMixin" defined the type as "Type[Other]") [assignment]
53-
main:8: error: Incompatible types in assignment (expression has type "_QuerySet[MyModel, MyModel]", base class "SingleObjectMixin" defined the type as "Optional[_QuerySet[Other, Other]]") [assignment]
54-
main:10: error: Return type "_QuerySet[MyModel, MyModel]" of "get_queryset" incompatible with return type "_QuerySet[Other, Other]" in supertype "SingleObjectMixin" [override]
55-
main:12: error: Incompatible return value type (got "_QuerySet[Other, Other]", expected "_QuerySet[MyModel, MyModel]") [return-value]
53+
main:8: error: Incompatible types in assignment (expression has type "QuerySet[MyModel, MyModel]", base class "SingleObjectMixin" defined the type as "Optional[QuerySet[Other, Other]]") [assignment]
54+
main:10: error: Return type "QuerySet[MyModel, MyModel]" of "get_queryset" incompatible with return type "QuerySet[Other, Other]" in supertype "SingleObjectMixin" [override]
55+
main:12: error: Incompatible return value type (got "QuerySet[Other, Other]", expected "QuerySet[MyModel, MyModel]") [return-value]

tests/typecheck/views/generic/test_list.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@
4848
...
4949
out: |
5050
main:7: error: Incompatible types in assignment (expression has type "Type[MyModel]", base class "MultipleObjectMixin" defined the type as "Optional[Type[Other]]") [assignment]
51-
main:8: error: Incompatible types in assignment (expression has type "_QuerySet[MyModel, MyModel]", base class "MultipleObjectMixin" defined the type as "Optional[_SupportsPagination[Other]]") [assignment]
52-
main:10: error: Return type "_QuerySet[MyModel, MyModel]" of "get_queryset" incompatible with return type "_SupportsPagination[Other]" in supertype "MultipleObjectMixin" [override]
51+
main:8: error: Incompatible types in assignment (expression has type "QuerySet[MyModel, MyModel]", base class "MultipleObjectMixin" defined the type as "Optional[_SupportsPagination[Other]]") [assignment]
52+
main:10: error: Return type "QuerySet[MyModel, MyModel]" of "get_queryset" incompatible with return type "_SupportsPagination[Other]" in supertype "MultipleObjectMixin" [override]

0 commit comments

Comments
 (0)