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

Function into_pyarray_array

tests/to_py.rs:129–145  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

127
128#[test]
129fn into_pyarray_array() {
130 Python::attach(|py| {
131 let arr = Array3::<f64>::zeros((3, 4, 2));
132
133 let shape = arr.shape().to_vec();
134 let strides = arr
135 .strides()
136 .iter()
137 .map(|dim| dim * size_of::<f64>() as isize)
138 .collect::<Vec<_>>();
139
140 let py_arr = arr.into_pyarray(py);
141
142 assert_eq!(py_arr.shape(), shape.as_slice());
143 assert_eq!(py_arr.strides(), strides.as_slice());
144 });
145}
146
147#[test]
148fn into_pyarray_cannot_resize() {

Callers

nothing calls this directly

Calls 5

zerosFunction · 0.85
to_vecMethod · 0.80
stridesMethod · 0.80
into_pyarrayMethod · 0.80
shapeMethod · 0.45

Tested by

no test coverage detected