diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/enum.py | 2 | ||||
-rw-r--r-- | Lib/test/test_enum.py | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/Lib/enum.py b/Lib/enum.py index 5263e51..5548130 100644 --- a/Lib/enum.py +++ b/Lib/enum.py @@ -818,7 +818,7 @@ class EnumType(type): data_types.add(candidate or base) break else: - candidate = base + candidate = candidate or base if len(data_types) > 1: raise TypeError('%r: too many data types: %r' % (class_name, data_types)) elif data_types: diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py index 9a7882b..22a829d 100644 --- a/Lib/test/test_enum.py +++ b/Lib/test/test_enum.py @@ -658,6 +658,14 @@ class TestEnum(unittest.TestCase): def __repr__(self): return '<%s.%s: %r>' % (self.__class__.__name__, self._name_, self._value_) self.assertEqual(repr(MyEnum.A), '<MyEnum.A: 0x1>') + # + class SillyInt(HexInt): + pass + class MyOtherEnum(SillyInt, enum.Enum): + D = 4 + E = 5 + F = 6 + self.assertIs(MyOtherEnum._member_type_, SillyInt) def test_too_many_data_types(self): with self.assertRaisesRegex(TypeError, 'too many data types'): |