Skip to content
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

'IntEnum' values from different types compare equal #247

Closed
tseaver opened this issue Sep 22, 2021 · 1 comment · Fixed by #248
Closed

'IntEnum' values from different types compare equal #247

tseaver opened this issue Sep 22, 2021 · 1 comment · Fixed by #248
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@tseaver
Copy link
Contributor

tseaver commented Sep 22, 2021

For instance:

from google.cloud.firestore_v1.types import StructuredQuery

greater_than = StructuredQuery.FieldFilter.Operator.GREATER_THAN
is_null = StructuredQuery.UnaryFilter.Operator.IS_NULL

assert greater_than != is_null  # fails

This "false equivalence" is the source of googleapis/python-firestore#429

@tseaver tseaver added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Sep 22, 2021
@tseaver
Copy link
Contributor Author

tseaver commented Sep 22, 2021

The undesirable behavior is a consequence of using Python's IntEnum as a base. Per the docs, IntEnum-derivatives compare with different types, by design.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant