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

have comparisons return bool when both objects are values #611

Merged
merged 11 commits into from
Jul 5, 2024

Conversation

ekorman
Copy link
Contributor

@ekorman ekorman commented Jun 11, 2024

Currently, when two Equatable objects (that are not symbolic but have values) are compared, the result is a Boolean object instead of an actual bool. this causes some undesired behavior due to example bool(Boolean(False)) == True. and indeed test_add_prediction and test_create_image_dataset_with_detections were bad tests and actually should have been failing (see their updates)

This PR updates the following methods of Equatable to return bools when both sides have values:

  • __eq__
  • __ne__
  • in_
  • __gt__
  • __ge__
  • __lt__
  • __le__

@ekorman ekorman requested review from czaloom and ntlind as code owners June 11, 2024 14:54
@ekorman ekorman merged commit 5eff5be into main Jul 5, 2024
12 checks passed
@ekorman ekorman deleted the label-comparison branch July 5, 2024 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants