-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Ensure that UnrecognizedUnit.__eq__ never raises an exception. #7606
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
Conversation
|
Hi there @mhvk 👋 - thanks for the pull request! I'm just a friendly 🤖 that checks for issues related to the changelog and making sure that this pull request is milestoned and labeled correctly. This is mainly intended for the maintainers, so if you are not a maintainer you can ignore this, and a maintainer will let you know if any action is required on your part 😃. Everything looks good from my point of view! 👍 If there are any issues with this message, please report them here. |
|
Failure is a false-negative - URL issues (what else) |
|
Argh... I thought we fixed it... Though this one looks like a different kind of failure: |
8a827fb to
ee43ce3
Compare
| other = Unit(other, parse_strict='silent') | ||
| except (ValueError, UnitsError, TypeError): | ||
| return False | ||
| return NotImplemented |
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 was not quite right before: the python standard is to return NotImplemented if one cannot compare to other sensibly - so that other gets a chance. If other then also returns NotImplemented, False is returned automatically. This might be useful for interaction with other unit packages (if they are aware of astropy units, and we're not aware of them).
ee43ce3 to
53944e7
Compare
|
@taldcroft - any chance you might review this? |
astrofrog
left a comment
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.
Seems reasonable to me, but probably should get a review from a maintainer more familiar with the units code.
taldcroft
left a comment
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.
Looks good to me.
|
Thanks both for the reviews. Merging... |
Ensure that UnrecognizedUnit.__eq__ never raises an exception.
Ensure that UnrecognizedUnit.__eq__ never raises an exception.
fixes #7603
It just copies logic from
UnitBase.__eq__.