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

Function without_base_object

src/borrow/shared.rs:491–505  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

489
490 #[test]
491 fn without_base_object() {
492 Python::attach(|py| {
493 let array = PyArray::<f64, _>::zeros(py, (1, 2, 3), false);
494
495 let base = unsafe { (*array.as_array_ptr()).base };
496 assert!(base.is_null());
497
498 let base_address = base_address(py, array.as_array_ptr());
499 assert_eq!(base_address, array.as_ptr().cast());
500
501 let data_range = data_range(py, array.as_array_ptr());
502 assert_eq!(data_range.0, array.data() as *mut c_char);
503 assert_eq!(data_range.1, unsafe { array.data().add(6) } as *mut c_char);
504 });
505 }
506
507 #[test]
508 fn with_base_object() {

Callers

nothing calls this directly

Calls 4

zerosFunction · 0.85
base_addressFunction · 0.85
data_rangeFunction · 0.85
as_array_ptrMethod · 0.80

Tested by

no test coverage detected