MCPcopy Index your code
hub / github.com/PyO3/rust-numpy / from_rust_to_python

Function from_rust_to_python

src/datetime.rs:291–306  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

289
290 #[test]
291 fn from_rust_to_python() {
292 Python::attach(|py| {
293 let array = PyArray1::<Timedelta<units::Minutes>>::zeros(py, 1, false);
294
295 *array.readwrite().get_mut(0).unwrap() = Timedelta::<units::Minutes>::from(5);
296
297 let np = py
298 .eval(c_str!("__import__('numpy')"), None, None)
299 .unwrap()
300 .cast_into::<PyModule>()
301 .unwrap();
302
303 py_run!(py, array np, "assert array.dtype == np.dtype('timedelta64[m]')");
304 py_run!(py, array np, "assert array[0] == np.timedelta64(5, 'm')");
305 });
306 }
307
308 #[test]
309 fn debug_formatting() {

Callers

nothing calls this directly

Calls 3

zerosFunction · 0.85
readwriteMethod · 0.80
get_mutMethod · 0.45

Tested by

no test coverage detected