|
2 | 2 |
|
3 | 3 | import enum
|
4 | 4 | import sys
|
5 |
| -from typing import Any, Literal, Type |
| 5 | +from typing import Literal, Type |
6 | 6 | from typing_extensions import assert_type
|
7 | 7 |
|
8 | 8 | A = enum.Enum("A", "spam eggs bacon")
|
@@ -36,30 +36,3 @@ class Foo(enum.StrEnum):
|
36 | 36 |
|
37 | 37 | assert_type(Foo.X, Literal[Foo.X])
|
38 | 38 | assert_type(Foo.X.value, str)
|
39 |
| - |
40 |
| - |
41 |
| -if sys.version_info >= (3, 13): |
42 |
| - |
43 |
| - class MultiValueEnum(enum.Enum): |
44 |
| - def __new__(cls, value: object, *values: Any) -> "MultiValueEnum": |
45 |
| - self = object.__new__(cls) |
46 |
| - self._value_ = value |
47 |
| - for v in values: |
48 |
| - self._add_value_alias_(v) |
49 |
| - return self |
50 |
| - |
51 |
| - class DType(MultiValueEnum): |
52 |
| - float32 = "f", 8 |
53 |
| - double64 = "d", 9 |
54 |
| - |
55 |
| - # Test type inference for primary values |
56 |
| - assert_type(DType("f"), DType) |
57 |
| - assert_type(DType("d"), DType) |
58 |
| - |
59 |
| - # Test type inference for alias values |
60 |
| - assert_type(DType(8), DType) |
61 |
| - assert_type(DType(9), DType) |
62 |
| - |
63 |
| - # Test that the enum members have the correct literal types |
64 |
| - assert_type(DType.float32, Literal[DType.float32]) |
65 |
| - assert_type(DType.double64, Literal[DType.double64]) |
0 commit comments