Skip to content

Commit

Permalink
add additional failing test for ModelAdmin generic (typeddjango#505)
Browse files Browse the repository at this point in the history
this will ensure that the generic constraint holds
  • Loading branch information
proxy authored Oct 28, 2020
1 parent ffb6551 commit e2f6abe
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test-data/typecheck/contrib/admin/test_options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,13 @@
class A(admin.ModelAdmin):
actions = [an_action] # E: List item 0 has incompatible type "Callable[[None], None]"; expected "Union[Callable[[ModelAdmin[Any], HttpRequest, QuerySet[Any]], None], str]"
- case: errors_for_invalid_model_admin_generic
main: |
from django.contrib.admin import ModelAdmin
from django.db.models import Model
class TestModel(Model):
pass
class A(ModelAdmin[TestModel]):
model = int # E: Incompatible types in assignment (expression has type "Type[int]", base class "ModelAdmin" defined the type as "Type[TestModel]")

0 comments on commit e2f6abe

Please sign in to comment.