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

Function handle_negative_strides

tests/array.rs:366–386  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

364
365#[test]
366fn handle_negative_strides() {
367 Python::attach(|py| {
368 let arr = array![[2, 3], [4, 5u32]];
369 let pyarr = arr.to_pyarray(py);
370
371 let neg_str_pyarr = py
372 .eval(
373 c_str!("a[::-1]"),
374 Some(&[("a", pyarr)].into_py_dict(py).unwrap()),
375 None,
376 )
377 .unwrap()
378 .cast_into::<PyArray2<u32>>()
379 .unwrap();
380
381 assert_eq!(
382 neg_str_pyarr.readonly().as_array(),
383 arr.slice(s![..;-1, ..])
384 );
385 });
386}
387
388#[test]
389fn dtype_via_python_attribute() {

Callers

nothing calls this directly

Calls 1

to_pyarrayMethod · 0.80

Tested by

no test coverage detected