| 186 | /// contains the panic’s payload, if that payload was a string. |
| 187 | #[test] |
| 188 | fn panicking() { |
| 189 | fn f(_py: Python) -> PyResult<PyNone> { |
| 190 | panic!("panicking because {}", "reasons") |
| 191 | } |
| 192 | |
| 193 | let gil = Python::acquire_gil(); |
| 194 | let py = gil.python(); |
| 195 | let obj = py_fn!(py, f()); |
| 196 | |
| 197 | assert_eq!( |
| 198 | obj.call(py, NoArgs, None) |
| 199 | .unwrap_err() // Expect an exception |
| 200 | .instance(py) |
| 201 | .str(py) |
| 202 | .unwrap() |
| 203 | .to_string_lossy(py), |
| 204 | "Rust panic: panicking because reasons" |
| 205 | ); |
| 206 | } |
| 207 | |
| 208 | /* TODO: reimplement flexible sig support |
| 209 | #[test] |