| 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() { |