Skip to content

Too many arguments for "TextChoices" #1857

@Kangaroux

Description

@Kangaroux

Bug report

What's wrong

The stubs package does not support the functional enum API for choice enums.

How is that should be

Enum classes like TextChoices support the functional enum API (4th code block in that section).

System information

  • OS:
  • python version: 3.10.12
  • django version: 4.2.8
  • mypy version: 1.7.1
  • django-stubs version: 4.2.7
  • django-stubs-ext version: 4.2.7

Repro

from enum import Enum
from django.db.models import TextChoices

Enum("test", "A B C")
TextChoices("test", "A B C")
repro.py:5:1: error: Too many arguments for "TextChoices"  [call-arg]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomersstubsIssues in stubs files (.pyi)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions