Skip to content

BUG: Ensure comparisons on scalar strings pass without warning. #11405

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

Merged
merged 1 commit into from
Jun 21, 2018

Conversation

mhvk
Copy link
Contributor

@mhvk mhvk commented Jun 21, 2018

Astropy testing (astropy/astropy#7587) found a problem with #11282 - scalar strings and scalar numbers now giving deprecation errors. Turns out to have been the result of an overzealous removal of a test whether self was flexible, something that sadly was not tested at all in our test suite. Fixed here.

fixes astropy/astropy#7587

@mhvk
Copy link
Contributor Author

mhvk commented Jun 21, 2018

@eric-wieser - thanks for the quick review - will merge when tests pass...

@mhvk mhvk force-pushed the correct_scalar_comparison branch from 876e1f8 to 77cc160 Compare June 21, 2018 19:14
@mhvk
Copy link
Contributor Author

mhvk commented Jun 21, 2018

Hmm, clearly my own testing setup is not good, not triggering on FutureWarning (I just use runtests.py, weird). But the good news is that now something that managed to slip by the warnings no longer does so.

# that fact (it likely should be changed). This means that the
# following works (and returns False) due to dtype mismatch:
a == []
# The empty list is not cast to string, and this used to pass due
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More accurate would be "The empty list is cast to float64", I think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but not quite worth rerunning the whole test suite...

@mhvk mhvk merged commit a6d0800 into numpy:master Jun 21, 2018
@mhvk mhvk deleted the correct_scalar_comparison branch June 21, 2018 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TST: DeprecationWarning elementwise comparison failed
2 participants