()
| 32 | |
| 33 | #[test] |
| 34 | fn to_pyarray_array() { |
| 35 | Python::attach(|py| { |
| 36 | let arr = Array3::<f64>::zeros((3, 4, 2)); |
| 37 | |
| 38 | let shape = arr.shape().to_vec(); |
| 39 | let strides = arr |
| 40 | .strides() |
| 41 | .iter() |
| 42 | .map(|dim| dim * size_of::<f64>() as isize) |
| 43 | .collect::<Vec<_>>(); |
| 44 | |
| 45 | let py_arr = PyArray::from_array(py, &arr); |
| 46 | |
| 47 | assert_eq!(py_arr.shape(), shape.as_slice()); |
| 48 | assert_eq!(py_arr.strides(), strides.as_slice()); |
| 49 | }); |
| 50 | } |
| 51 | |
| 52 | #[test] |
| 53 | fn iter_to_pyarray() { |