|
| 1 | +use std::borrow::Cow; |
| 2 | + |
1 | 3 | use pyo3::prelude::*; |
2 | 4 | use pyo3::types::PyString; |
3 | 5 | use pyo3::{PyAny, PyResult}; |
@@ -59,8 +61,8 @@ impl<'py> IntoPyObject<'py> for Outcome { |
59 | 61 |
|
60 | 62 | impl<'py> FromPyObject<'py> for Outcome { |
61 | 63 | fn extract_bound(ob: &Bound<'py, PyAny>) -> PyResult<Self> { |
62 | | - let s = ob.extract::<&str>()?; |
63 | | - match s { |
| 64 | + let s: String = ob.extract()?; |
| 65 | + match s.as_str() { |
64 | 66 | "pass" => Ok(Outcome::Pass), |
65 | 67 | "failure" => Ok(Outcome::Failure), |
66 | 68 | "skip" => Ok(Outcome::Skip), |
@@ -98,14 +100,14 @@ impl<'py> IntoPyObject<'py> for Framework { |
98 | 100 |
|
99 | 101 | impl<'py> FromPyObject<'py> for Framework { |
100 | 102 | fn extract_bound(ob: &Bound<'py, PyAny>) -> PyResult<Self> { |
101 | | - let s = ob.extract::<&str>()?; |
102 | | - match s { |
| 103 | + let s: String = ob.extract()?; |
| 104 | + match s.as_str() { |
103 | 105 | "Pytest" => Ok(Framework::Pytest), |
104 | 106 | "Vitest" => Ok(Framework::Vitest), |
105 | 107 | "Jest" => Ok(Framework::Jest), |
106 | 108 | "PHPUnit" => Ok(Framework::PHPUnit), |
107 | 109 | _ => Err(PyErr::new::<pyo3::exceptions::PyValueError, _>(format!( |
108 | | - "Invalid outcome: {}", |
| 110 | + "Invalid framework: {}", |
109 | 111 | s |
110 | 112 | ))), |
111 | 113 | } |
|
0 commit comments