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

Function extract_reference

tests/array_like.rs:16–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14
15#[test]
16fn extract_reference() {
17 Python::attach(|py| {
18 let locals = get_np_locals(py);
19 let py_array = py
20 .eval(
21 c_str!("np.array([[1,2],[3,4]], dtype='float64')"),
22 Some(&locals),
23 None,
24 )
25 .unwrap();
26 let extracted_array = py_array.extract::<PyArrayLike2<'_, f64>>().unwrap();
27
28 assert_eq!(
29 array![[1_f64, 2_f64], [3_f64, 4_f64]],
30 extracted_array.as_array()
31 );
32 });
33}
34
35#[test]
36fn convert_array_on_extract() {

Callers

nothing calls this directly

Calls 1

get_np_localsFunction · 0.70

Tested by

no test coverage detected