()
| 152 | |
| 153 | #[test] |
| 154 | fn as_array() { |
| 155 | Python::attach(|py| { |
| 156 | let pyarr = PyArray::<f64, _>::zeros(py, [3, 2, 4], false).readonly(); |
| 157 | let arr = pyarr.as_array(); |
| 158 | |
| 159 | assert_eq!(pyarr.shape(), arr.shape()); |
| 160 | assert_eq!( |
| 161 | pyarr |
| 162 | .strides() |
| 163 | .iter() |
| 164 | .map(|x| x / size_of::<f64>() as isize) |
| 165 | .collect::<Vec<_>>(), |
| 166 | arr.strides() |
| 167 | ); |
| 168 | |
| 169 | let not_contiguous = not_contiguous_array(py).readonly(); |
| 170 | assert_eq!(not_contiguous.as_array(), array![1, 3]); |
| 171 | }); |
| 172 | } |
| 173 | |
| 174 | #[test] |
| 175 | fn as_raw_array() { |
nothing calls this directly
no test coverage detected