-
Notifications
You must be signed in to change notification settings - Fork 828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hashable Enum #1461
hashable Enum #1461
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Small comment, other than that it is good to merge! 🚀
RED = 1 | ||
GREEN = 2 | ||
BLUE = 3 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should also include the instance-creation pattern for enums, to ensure completeness:
https://docs.graphene-python.org/en/latest/types/enums/#definition
Episode = graphene.Enum('Episode', [('NEWHOPE', 4), ('EMPIRE', 5), ('JEDI', 6)])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I added a test in my amended commit.
Codecov ReportBase: 95.87% // Head: 95.88% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #1461 +/- ##
=======================================
Coverage 95.87% 95.88%
=======================================
Files 50 50
Lines 1722 1724 +2
=======================================
+ Hits 1651 1653 +2
Misses 71 71
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Thank you! |
It would be convenient for
graphene.Enum
to be hashable the same wayenum.Enum
is so that it can be used as a key in a dict or a member of a set.