Skip to content

Commit e2f6abe

Browse files
author
proxy
authored
add additional failing test for ModelAdmin generic (#505)
this will ensure that the generic constraint holds
1 parent ffb6551 commit e2f6abe

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test-data/typecheck/contrib/admin/test_options.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,13 @@
136136
137137
class A(admin.ModelAdmin):
138138
actions = [an_action] # E: List item 0 has incompatible type "Callable[[None], None]"; expected "Union[Callable[[ModelAdmin[Any], HttpRequest, QuerySet[Any]], None], str]"
139+
- case: errors_for_invalid_model_admin_generic
140+
main: |
141+
from django.contrib.admin import ModelAdmin
142+
from django.db.models import Model
143+
144+
class TestModel(Model):
145+
pass
146+
147+
class A(ModelAdmin[TestModel]):
148+
model = int # E: Incompatible types in assignment (expression has type "Type[int]", base class "ModelAdmin" defined the type as "Type[TestModel]")

0 commit comments

Comments
 (0)