Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
5b3902c6
Commit
5b3902c6
authored
May 01, 2016
by
Ethan Furman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
issue26893: use mro() to examine class heirarchy
parent
b4b1a347
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
Lib/enum.py
Lib/enum.py
+1
-1
Lib/test/test_enum.py
Lib/test/test_enum.py
+13
-0
No files found.
Lib/enum.py
View file @
5b3902c6
...
...
@@ -118,7 +118,7 @@ class EnumMeta(type):
# save attributes from super classes so we know if we can take
# 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.
enum_class
.
_value2member_map_
=
{}
...
...
Lib/test/test_enum.py
View file @
5b3902c6
...
...
@@ -1568,6 +1568,19 @@ class TestUnique(unittest.TestCase):
triple
=
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
=
"""
\
Help on class Color in module %s:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment