diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2022-06-16 19:16:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-16 19:16:12 (GMT) |
commit | 138db8e48b0bb006b1561f8ec76ade97afc6cbd7 (patch) | |
tree | cff5a81a9624b389d3201257e2a80f3747020954 /Lib/test/test_enum.py | |
parent | ab45c1dde0e46603342f751552f06b8deb294832 (diff) | |
download | cpython-138db8e48b0bb006b1561f8ec76ade97afc6cbd7.zip cpython-138db8e48b0bb006b1561f8ec76ade97afc6cbd7.tar.gz cpython-138db8e48b0bb006b1561f8ec76ade97afc6cbd7.tar.bz2 |
gh-93847: Fix repr of enum of generic aliases (GH-93885)
Diffstat (limited to 'Lib/test/test_enum.py')
-rw-r--r-- | Lib/test/test_enum.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py index 28594b0..2fadb4e 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 @@ -980,6 +981,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', |