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

Function convert_array_on_extract

tests/array_like.rs:36–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34
35#[test]
36fn convert_array_on_extract() {
37 Python::attach(|py| {
38 let locals = get_np_locals(py);
39 let py_array = py
40 .eval(
41 c_str!("np.array([[1,2],[3,4]], dtype='int32')"),
42 Some(&locals),
43 None,
44 )
45 .unwrap();
46 let extracted_array = py_array
47 .extract::<PyArrayLike2<'_, f64, AllowTypeChange>>()
48 .unwrap();
49
50 assert_eq!(
51 array![[1_f64, 2_f64], [3_f64, 4_f64]],
52 extracted_array.as_array()
53 );
54 });
55}
56
57#[test]
58fn convert_list_on_extract() {

Callers

nothing calls this directly

Calls 1

get_np_localsFunction · 0.70

Tested by

no test coverage detected