MCPcopy Create free account
hub / github.com/PyO3/rust-numpy / collapsed_into_pyarray

Function collapsed_into_pyarray

tests/to_py.rs:169–182  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

167
168#[test]
169fn collapsed_into_pyarray() {
170 // Check that `into_pyarray` works for array with the pointer of the first element is
171 // not at the start of the allocation.
172 // See https://github.com/PyO3/rust-numpy/issues/182 for more.
173 Python::attach(|py| {
174 let mut arr = Array2::<f64>::from_shape_fn([3, 4], |(i, j)| (i * 10 + j) as f64);
175 arr.slice_collapse(s![1.., ..]);
176 let cloned_arr = arr.clone();
177
178 let py_arr = arr.into_pyarray(py);
179
180 assert_eq!(py_arr.readonly().as_array(), cloned_arr);
181 });
182}
183
184#[test]
185fn sliced_to_pyarray() {

Callers

nothing calls this directly

Calls 2

cloneMethod · 0.80
into_pyarrayMethod · 0.80

Tested by

no test coverage detected