Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions stdlib/enum.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ if sys.version_info >= (3, 11):
_value_: str
@_magic_enum_attr
def value(self) -> str: ...
@staticmethod
def _generate_next_value_(name: str, start: int, count: int, last_values: list[str]) -> str: ...

class EnumCheck(StrEnum):
CONTINUOUS: str
Expand Down
13 changes: 13 additions & 0 deletions test_cases/stdlib/check_enum.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from __future__ import annotations

import enum
import sys
from typing_extensions import Literal, assert_type

if sys.version_info >= (3, 11):

class Foo(enum.StrEnum):
X = enum.auto()

assert_type(Foo.X, Literal[Foo.X])
assert_type(Foo.X.value, str)
2 changes: 2 additions & 0 deletions tests/stubtest_allowlists/py311.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ configparser.LegacyInterpolation.__init__
configparser.ParsingError.filename
enum.Enum.__init__
enum.Enum._generate_next_value_
# Not strictly speaking a staticmethod on 3.11, but it acts like one:
enum.StrEnum._generate_next_value_
importlib.abc.Finder.find_module
ipaddress._BaseNetwork.broadcast_address
ipaddress._BaseNetwork.hostmask
Expand Down