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

handle NaN case nicely in _is_sorted #2744

Merged
merged 2 commits into from Jan 27, 2014
Merged

Conversation

perimosocordiae
Copy link
Contributor

Previously, the >= comparison would cause a

RuntimeWarning: invalid value encountered in greater_equal

Here, np.amin propagates NaN values appropriately,
which results in a single (non-ufunc) comparison that doesn't trigger any warnings.

Previously, the `>=` comparison would cause a
"RuntimeWarning: invalid value encountered in greater_equal".

Here, `np.amin` propagates NaN values appropriately
and doesn't cause the warning to throw.
@mdboom
Copy link
Member

mdboom commented Jan 21, 2014

Can you include a unit test that exercises the bug?

@perimosocordiae
Copy link
Contributor Author

I added a test case, but I'm not sure how best to catch the warning message. Does nose provide something that will fail the test if a RuntimeWarning is thrown?

@mdboom
Copy link
Member

mdboom commented Jan 27, 2014

I think that test is find without catching the warning (it would be ideal, but it's tricky to get right, particularly if tests are run in parallel, since warnings depend on global state).

Thanks for the contribution. Merging.

mdboom added a commit that referenced this pull request Jan 27, 2014
handle NaN case nicely in _is_sorted
@mdboom mdboom merged commit da6cc34 into matplotlib:master Jan 27, 2014
@perimosocordiae perimosocordiae deleted the patch-1 branch January 27, 2014 19:37
solvents pushed a commit to solvents/matplotlib that referenced this pull request Apr 22, 2014
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.

None yet

2 participants