Skip to content

Commit 5645a80

Browse files
committed
[test] No longer use np.frombuffer to convert LowLevelView arrays to numpy
This was a (terrible) workaround to the fact that resulting views of multidim arrays did not convey the right itemsize based on the underlying type. Now that #21378 is fixed, the workaround breaks and we can just use `np.array(arr, dtype)` which is a lot better and Pythonic for users.
1 parent decd59b commit 5645a80

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

bindings/pyroot/pythonizations/test/array_conversions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def test_2DArray_NumpyView(self):
122122
"""
123123
for dtype in self.typemap:
124124
cpp_arr = self.generate_cpp_arrays(dtype[1])
125-
np_obj = np.frombuffer(cpp_arr, dtype[0], count=11 * 2).reshape(11, 2)
125+
np_obj = np.array(cpp_arr, dtype=dtype[0])
126126
self.check_shape(cpp_arr, np_obj)
127127
self.validate_numpy_view(np_obj, dtype)
128128

0 commit comments

Comments
 (0)