Skip to content

Fix assert_almost_equal, add test #48920

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

Closed

Conversation

andrewgsavage
Copy link

@@ -21,7 +21,11 @@ from pandas.core.dtypes.missing import (


cdef bint isiterable(obj):
return hasattr(obj, '__iter__')
if hasattr(obj, '__iter__'):
Copy link
Member

Choose a reason for hiding this comment

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

I'm not completely convinced this is an appropriate fix to simply exclude 0-D arrays here. This might have unintended consequences where we want to treat 0-D arrays as iterable.

Copy link
Author

Choose a reason for hiding this comment

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

I've changed it to use try/except. Is this an appropiate fix?

[
(MockNumpyLikeArray(np.ndarray((2,) * 1)), "duck-ndarray-1d"),
(MockNumpyLikeArray(np.array([])), "duck-ndarray-1d-empty"),
(MockNumpyLikeArray(np.array(2)), "duck-ndarray-0d"),
Copy link
Member

Choose a reason for hiding this comment

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

The description should be passed as a list to ids=[...]

@mroeschke mroeschke added the Testing pandas testing functions or related to the test suite label Oct 3, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2022

This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label Nov 4, 2022
@mroeschke
Copy link
Member

Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: Enable assert_almost_equal to test numpy-like zero-dimensional arrays
2 participants