|
76 | 76 | unique_together = {1: 2} # E: Incompatible types in assignment (expression has type "dict[int, int]", base class "TypedModelMeta" defined the type as "Sequence[Sequence[str]]") [assignment]
|
77 | 77 | unknown_attr = True # can't check this
|
78 | 78 |
|
| 79 | + class MyModelMultipleBaseMeta(models.Model): |
| 80 | + class Meta(MyModel.Meta, TypedModelMeta): |
| 81 | + abstract = 7 # E: Incompatible types in assignment (expression has type "int", base class "TypedModelMeta" defined the type as "bool") [assignment] |
| 82 | +
|
| 83 | +- case: auto_base_model_meta_incompatible_types |
| 84 | + main: | |
| 85 | + from myapp.models import MyModelWithAutoTypedMeta |
| 86 | + installed_apps: |
| 87 | + - myapp |
| 88 | + files: |
| 89 | + - path: myapp/__init__.py |
| 90 | + - path: myapp/models.py |
| 91 | + content: | |
| 92 | + from django.db import models |
| 93 | +
|
| 94 | + class MyModelWithAutoTypedMeta(models.Model): |
| 95 | + example = models.CharField(max_length=100) |
| 96 | + class Meta: |
| 97 | + abstract = 7 # E: Incompatible types in assignment (expression has type "int", base class "TypedModelMeta" defined the type as "bool") [assignment] |
| 98 | + verbose_name = ['test'] # E: Incompatible types in assignment (expression has type "list[str]", base class "TypedModelMeta" defined the type as "str | _StrPromise") [assignment] |
| 99 | + unique_together = {1: 2} # E: Incompatible types in assignment (expression has type "dict[int, int]", base class "TypedModelMeta" defined the type as "Sequence[Sequence[str]]") [assignment] |
| 100 | +
|
| 101 | + class DefinitelyNotAModel: |
| 102 | + class Meta: |
| 103 | + abstract = 7 |
| 104 | + verbose_name = ['test'] |
| 105 | + unique_together = {1: 2} |
| 106 | + unknown_attr = True |
| 107 | +
|
| 108 | +- case: auto_base_model_meta_incompatible_types_multiple_inheritance |
| 109 | + main: | |
| 110 | + from myapp.models import MyModel, MyModel2, MyModel3 |
| 111 | + installed_apps: |
| 112 | + - myapp |
| 113 | + files: |
| 114 | + - path: myapp/__init__.py |
| 115 | + - path: myapp/models.py |
| 116 | + content: | |
| 117 | + from django.db import models |
| 118 | +
|
| 119 | + class MyModel(models.Model): |
| 120 | + class Meta: |
| 121 | + abstract = 5 # E: Incompatible types in assignment (expression has type "int", base class "TypedModelMeta" defined the type as "bool") [assignment] |
| 122 | +
|
| 123 | + class MyModel2(models.Model): |
| 124 | + class Meta: |
| 125 | + abstract = 5 # E: Incompatible types in assignment (expression has type "int", base class "TypedModelMeta" defined the type as "bool") [assignment] |
| 126 | +
|
| 127 | + class MyModel3(models.Model): |
| 128 | + class Meta(MyModel.Meta, MyModel2.Meta): |
| 129 | + abstract = 7 # Ok because both base class declare int currently |
| 130 | + verbose_name = ['test'] # E: Incompatible types in assignment (expression has type "list[str]", base class "TypedModelMeta" defined the type as "str | _StrPromise") [assignment] |
| 131 | + unique_together = {1: 2} # E: Incompatible types in assignment (expression has type "dict[int, int]", base class "TypedModelMeta" defined the type as "Sequence[Sequence[str]]") [assignment] |
79 | 132 |
|
80 | 133 | - case: instantiate_abstract_model
|
81 | 134 | main: |
|
|
0 commit comments