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

Function resize_using_exclusive_borrow

tests/borrow.rs:339–350  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

337
338#[test]
339fn resize_using_exclusive_borrow() {
340 Python::attach(|py| {
341 let array = PyArray::<f64, _>::zeros(py, 3, false);
342 assert_eq!(array.shape(), [3]);
343
344 let mut array = array.into_readwrite();
345 assert_eq!(array.as_slice_mut().unwrap(), &[0.0; 3]);
346
347 let mut array = array.resize(5).unwrap();
348 assert_eq!(array.as_slice_mut().unwrap(), &[0.0; 5]);
349 });
350}
351
352#[test]
353fn can_make_python_array_nonwriteable() {

Callers

nothing calls this directly

Calls 3

zerosFunction · 0.85
into_readwriteMethod · 0.80
resizeMethod · 0.45

Tested by

no test coverage detected