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

Function array_with_zero_dimensions

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

Source from the content-addressed store, hash-verified

724
725 #[test]
726 fn array_with_zero_dimensions() {
727 Python::attach(|py| {
728 let array = PyArray::<f64, _>::zeros(py, (1, 0, 3), false);
729
730 let base = unsafe { (*array.as_array_ptr()).base };
731 assert!(base.is_null());
732
733 let base_address = base_address(py, array.as_array_ptr());
734 assert_eq!(base_address, array.as_ptr().cast::<c_void>());
735
736 let data_range = data_range(py, array.as_array_ptr());
737 assert_eq!(data_range.0, array.data() as *mut c_char);
738 assert_eq!(data_range.1, array.data() as *mut c_char);
739 });
740 }
741
742 #[test]
743 fn view_with_non_dividing_strides() {

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