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

Function unsafe_cast_shall_fail

tests/array_like.rs:119–133  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

117
118#[test]
119fn unsafe_cast_shall_fail() {
120 Python::attach(|py| {
121 let locals = get_np_locals(py);
122 let py_list = py
123 .eval(
124 c_str!("np.array([1.1,2.2,3.3,4.4], dtype='float64')"),
125 Some(&locals),
126 None,
127 )
128 .unwrap();
129 let extracted_array = py_list.extract::<PyArrayLike1<'_, i32>>();
130
131 assert!(extracted_array.is_err());
132 });
133}
134
135#[test]
136fn extract_1d_array_of_different_float_types_fail() {

Callers

nothing calls this directly

Calls 1

get_np_localsFunction · 0.70

Tested by

no test coverage detected