-
Notifications
You must be signed in to change notification settings - Fork 60
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
Test get_buffer_data
and get_buffer_nbytes
#549
Conversation
Provide some initial testing of the buffer utility functions with Python builtin types. This provides us something pretty useful that we can run through without having to worry about any dependencies to start with.
54fcb02
to
06bbdfc
Compare
Include some tests using NumPy and CuPy arrays. Check that pointers are what we expect them to be. Also check that `nbytes` is computed correctly.
06bbdfc
to
2087d65
Compare
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.
I have a couple of minor questions only, otherwise it looks good. Also, do these tests allow us to check for the issue from #546 (comment) ?
arr = xp.ndarray(shape, dtype, data.data, strides=strides) | ||
iface = getattr(arr, iface_prop) | ||
|
||
return xp, arr, iface |
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 like xp
isn't currently used for anything. Just wanted to check this is intentional.
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.
Yeah I wasn't sure if we would need it or not. So left in the option. We could drop it if you prefer.
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.
No worries, just wanted to confirm.
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.
LGTM
LGTM, thanks @jakirkham . |
Needed for PR ( #546 )
Adds some tests for the utility functions
get_buffer_data
andget_buffer_nbytes
using both Python builtin objects and NumPy/CuPy arrays. Should exercise both thememoryview
case as well as the__array_interface__
/__cuda_array_interface__
case.