mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-93847: Fix repr of enum of generic aliases (GH-93885)
(cherry picked from commit 138db8e48b
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
3fbf5c6427
commit
0319052090
3 changed files with 13 additions and 2 deletions
|
@ -7,6 +7,7 @@ import pydoc
|
|||
import sys
|
||||
import unittest
|
||||
import threading
|
||||
import typing
|
||||
import builtins as bltns
|
||||
from collections import OrderedDict
|
||||
from datetime import date
|
||||
|
@ -978,6 +979,15 @@ class TestSpecial(unittest.TestCase):
|
|||
spam = SpamEnumNotInner
|
||||
self.assertEqual(SpamEnum.spam.value, SpamEnumNotInner)
|
||||
|
||||
def test_enum_of_generic_aliases(self):
|
||||
class E(Enum):
|
||||
a = typing.List[int]
|
||||
b = list[int]
|
||||
self.assertEqual(E.a.value, typing.List[int])
|
||||
self.assertEqual(E.b.value, list[int])
|
||||
self.assertEqual(repr(E.a), '<E.a: typing.List[int]>')
|
||||
self.assertEqual(repr(E.b), '<E.b: list[int]>')
|
||||
|
||||
@unittest.skipIf(
|
||||
python_version >= (3, 13),
|
||||
'inner classes are not members',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue