-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Handle numpy-like arrays in assert_almost_equal #39790
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
ENH: Handle numpy-like arrays in assert_almost_equal #39790
Conversation
znicholls
commented
Feb 13, 2021
- closes #xxxx
- tests added / passed
- Ensure all linting tests pass, see here for how to run them
- whatsnew entry
At this point, the test fails because |
I added an |
sound like you need to add a function which can return true if not is_array but has size / dtype; and then use it in but stepping back here. I thought Pint is using the EA interface; if this is the case then no changes should be needed here at all. if this is not the case, then can you explain why? |
Because the comparisons should be defined elsewhere? In any case, it does appear this is the case. I think I've started at the wrong spot. I'll try again in a different MR (feel free to close for now, I can re-open if needed). |
@jreback I have dug deeper on this. The test in which this is an issue is
Casting both
|
Or we just skip that test entirely like
|
do the inputs have an |
@@ -119,7 +121,7 @@ cpdef assert_almost_equal(a, b, | |||
f"Can't compare objects without length, one or both is invalid: ({a}, {b})" | |||
) | |||
|
|||
if a_is_ndarray and b_is_ndarray: | |||
if (a_is_ndarray and b_is_ndarray) or (a_has_size_and_shape and b_has_size_and_shape): |
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.
arent the is_array checks redundant here?
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.
Probably, I had kept them in case there was some edge case I hadn't thought of but I can also remove them
Yep sorry I realised that after the fact (comment here #39790 (comment), fix here ad5f714) |
so with the |
The test changes are still needed. The reason is that you need something over and above |
This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this. |
@znicholls Thanks for the PR. closing as stale. |