summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_enum.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-06-17 05:00:22 (GMT)
committerGitHub <noreply@github.com>2022-06-17 05:00:22 (GMT)
commit0319052090721a966892ee1384ce1246f09f7020 (patch)
tree0c8432fa89afd0106eeb02bcf90d1a2ba026236c /Lib/test/test_enum.py
parent3fbf5c6427c260eab41c37f6eb7f66b79ab4ea88 (diff)
downloadcpython-0319052090721a966892ee1384ce1246f09f7020.zip
cpython-0319052090721a966892ee1384ce1246f09f7020.tar.gz
cpython-0319052090721a966892ee1384ce1246f09f7020.tar.bz2
gh-93847: Fix repr of enum of generic aliases (GH-93885)
(cherry picked from commit 138db8e48b0bb006b1561f8ec76ade97afc6cbd7) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Lib/test/test_enum.py')
-rw-r--r--Lib/test/test_enum.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py
index b44c566..66c7767 100644
--- a/Lib/test/test_enum.py
+++ b/Lib/test/test_enum.py
@@ -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',