diff options
author | Dong-hee Na <donghee.na@python.org> | 2023-03-23 20:30:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-23 20:30:18 (GMT) |
commit | bd063756b34003c1bc7cacf5b1bd90a409180fb6 (patch) | |
tree | 886c4614e9bda5fc6e360f22ca245b0b5875a32e /Lib/test/test_enum.py | |
parent | 16f6165b71e81b5e4d0be660ac64a9fce7dfd86c (diff) | |
download | cpython-bd063756b34003c1bc7cacf5b1bd90a409180fb6.zip cpython-bd063756b34003c1bc7cacf5b1bd90a409180fb6.tar.gz cpython-bd063756b34003c1bc7cacf5b1bd90a409180fb6.tar.bz2 |
gh-102558: [Enum] fix AttributeError during member repr() (GH-102601)
Diffstat (limited to 'Lib/test/test_enum.py')
-rw-r--r-- | Lib/test/test_enum.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py index a11bb44..bb163c4 100644 --- a/Lib/test/test_enum.py +++ b/Lib/test/test_enum.py @@ -11,7 +11,7 @@ import typing import builtins as bltns from collections import OrderedDict from datetime import date -from enum import Enum, IntEnum, StrEnum, EnumType, Flag, IntFlag, unique, auto +from enum import Enum, EnumMeta, IntEnum, StrEnum, EnumType, Flag, IntFlag, unique, auto from enum import STRICT, CONFORM, EJECT, KEEP, _simple_enum, _test_simple_enum from enum import verify, UNIQUE, CONTINUOUS, NAMED_FLAGS, ReprEnum from enum import member, nonmember, _iter_bits_lsb @@ -644,6 +644,13 @@ class _EnumTests: theother = auto() self.assertEqual(repr(MySubEnum.that), "My name is that.") + def test_multiple_superclasses_repr(self): + class _EnumSuperClass(metaclass=EnumMeta): + pass + class E(_EnumSuperClass, Enum): + A = 1 + self.assertEqual(repr(E.A), "<E.A: 1>") + def test_reversed_iteration_order(self): self.assertEqual( list(reversed(self.MainEnum)), |