We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I expect the following code to always succeed.
It succeeds in simple scripts. But in a larger code base it fails:
class Kind(graphene.Enum): INTERMEDIATE_FAVORABLE = "intermediate_favorable" assert Kind.INTERMEDIATE_FAVORABLE == "intermediate_favorable"
The cause of the bug is here: https://github.com/graphql-python/graphene/blob/master/graphene/types/enum.py#L12
Equivalent strings are not guaranteed to have the same id.
def eq_enum(self, other): if isinstance(other, self.__class__): return self is other return self.value is other
There's a one-line bug fix:
def eq_enum(self, other): if isinstance(other, self.__class__): return self is other return self.value == other
And I suppose maybe an optimization:
def eq_enum(self, other): if isinstance(other, self.__class__): return self is other return self.value is other or self.value == other
The text was updated successfully, but these errors were encountered:
No branches or pull requests
What is the expected behavior?
I expect the following code to always succeed.
It succeeds in simple scripts. But in a larger code base it fails:
Version
Other information
The cause of the bug is here:
https://github.com/graphql-python/graphene/blob/master/graphene/types/enum.py#L12
Equivalent strings are not guaranteed to have the same id.
There's a one-line bug fix:
And I suppose maybe an optimization:
The text was updated successfully, but these errors were encountered: