| 184 | |
| 185 | #[test] |
| 186 | fn task_result_wraps_buffer() { |
| 187 | pyo3::prepare_freethreaded_python(); |
| 188 | |
| 189 | Python::with_gil(|py| { |
| 190 | let handle = TaskHandle::new(); |
| 191 | let buf = crate::buffer::inner::Buffer::from_f64_vec(vec![1.0, 2.0, 3.0]); |
| 192 | handle.complete(TaskResult::Buffer(buf)); |
| 193 | |
| 194 | let result = PyTaskHandle::new(handle).result(py).unwrap(); |
| 195 | let result = result.extract::<PyBuffer>(py).unwrap(); |
| 196 | assert_eq!(result.inner.as_f64_slice(), &[1.0, 2.0, 3.0]); |
| 197 | }); |
| 198 | } |
| 199 | |
| 200 | #[test] |
| 201 | fn task_result_returns_python_object_for_callable_why_callable_go_must_not_force_buffer_wrapping( |