mirror of https://github.com/python/cpython
issue26893: use mro() to examine class heirarchy
This commit is contained in:
parent
dd1bcdf618
commit
3803ad47bb
|
@ -118,7 +118,7 @@ class EnumMeta(type):
|
||||||
|
|
||||||
# save attributes from super classes so we know if we can take
|
# save attributes from super classes so we know if we can take
|
||||||
# the shortcut of storing members in the class dict
|
# the shortcut of storing members in the class dict
|
||||||
base_attributes = {a for b in bases for a in b.__dict__}
|
base_attributes = {a for b in enum_class.mro() for a in b.__dict__}
|
||||||
|
|
||||||
# Reverse value->name map for hashable values.
|
# Reverse value->name map for hashable values.
|
||||||
enum_class._value2member_map_ = {}
|
enum_class._value2member_map_ = {}
|
||||||
|
|
|
@ -1568,6 +1568,19 @@ class TestUnique(unittest.TestCase):
|
||||||
triple = 3
|
triple = 3
|
||||||
turkey = 3
|
turkey = 3
|
||||||
|
|
||||||
|
def test_unique_with_name(self):
|
||||||
|
@unique
|
||||||
|
class Silly(Enum):
|
||||||
|
one = 1
|
||||||
|
two = 'dos'
|
||||||
|
name = 3
|
||||||
|
@unique
|
||||||
|
class Sillier(IntEnum):
|
||||||
|
single = 1
|
||||||
|
name = 2
|
||||||
|
triple = 3
|
||||||
|
value = 4
|
||||||
|
|
||||||
|
|
||||||
expected_help_output_with_docs = """\
|
expected_help_output_with_docs = """\
|
||||||
Help on class Color in module %s:
|
Help on class Color in module %s:
|
||||||
|
|
Loading…
Reference in New Issue