Open
Description
Bug report
What's wrong
Having an enum that extends TextChoices
declared inside another class (e.g. a model), results in the following error when running mypy
:
file.py: error: Unable to resolve type of choices property [misc]
Here's an example of such definition:
class MyModel:
class MyEnum(models.TextChoices):
foo = "foo", "Foo"
bar = "bar", "Bar"
a = MyEnum.foo
Running mypy against that:
file.py:9: error: Unable to resolve type of choices property [misc]
How is that should be
No error should happen.
System information
- OS:
python
version: 3.12.9django
version: 5.1.8mypy
version: 1.13.0django-stubs
version: 5.2.0django-stubs-ext
version: 5.2.0