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

Function readonly_as_array_slice_get

tests/borrow.rs:312–321  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

310
311#[test]
312fn readonly_as_array_slice_get() {
313 Python::attach(|py| {
314 let array = PyArray::<f64, _>::zeros(py, (1, 2, 3), false);
315 let array = array.readonly();
316
317 assert_eq!(array.as_array().shape(), [1, 2, 3]);
318 assert_eq!(array.as_slice().unwrap().len(), 2 * 3);
319 assert_eq!(*array.get([0, 1, 2]).unwrap(), 0.0);
320 });
321}
322
323#[test]
324fn readwrite_as_array_slice() {

Callers

nothing calls this directly

Calls 2

zerosFunction · 0.85
readonlyMethod · 0.80

Tested by

no test coverage detected