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

Function sliced_to_pyarray

tests/to_py.rs:185–196  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

183
184#[test]
185fn sliced_to_pyarray() {
186 Python::attach(|py| {
187 let matrix = Array2::from_shape_vec([4, 2], vec![0, 1, 2, 3, 4, 5, 6, 7]).unwrap();
188 let sliced_matrix = matrix.slice(s![1..4; -1, ..]);
189
190 let py_arr = sliced_matrix.to_pyarray(py);
191
192 assert_eq!(py_arr.readonly().as_array(), array![[6, 7], [4, 5], [2, 3]],);
193
194 py_run!(py, py_arr, "assert py_arr.flags['C_CONTIGUOUS']")
195 });
196}
197
198#[test]
199fn forder_to_pyarray() {

Callers

nothing calls this directly

Calls 1

to_pyarrayMethod · 0.80

Tested by

no test coverage detected