| 265 | |
| 266 | #[test] |
| 267 | fn from_python_to_rust() { |
| 268 | Python::attach(|py| { |
| 269 | let locals = py |
| 270 | .eval(c_str!("{ 'np': __import__('numpy') }"), None, None) |
| 271 | .unwrap() |
| 272 | .cast_into::<PyDict>() |
| 273 | .unwrap(); |
| 274 | |
| 275 | let array = py |
| 276 | .eval( |
| 277 | c_str!("np.array([np.datetime64('1970-01-01')])"), |
| 278 | None, |
| 279 | Some(&locals), |
| 280 | ) |
| 281 | .unwrap() |
| 282 | .cast_into::<PyArray1<Datetime<units::Days>>>() |
| 283 | .unwrap(); |
| 284 | |
| 285 | let value: i64 = array.get_owned(0).unwrap().into(); |
| 286 | assert_eq!(value, 0); |
| 287 | }); |
| 288 | } |
| 289 | |
| 290 | #[test] |
| 291 | fn from_rust_to_python() { |