(obj: PyObjectRef, vm: &VirtualMachine)
| 432 | } |
| 433 | |
| 434 | fn cast(obj: PyObjectRef, vm: &VirtualMachine) -> PyResult<Self> { |
| 435 | let then = vm.get_attribute_opt(obj.clone(), "then")?; |
| 436 | let value = if let Some(then) = then.filter(|obj| obj.is_callable()) { |
| 437 | PromiseKind::PyProm { then } |
| 438 | } else { |
| 439 | PromiseKind::PyResolved(obj) |
| 440 | }; |
| 441 | Ok(Self { value }) |
| 442 | } |
| 443 | |
| 444 | fn cast_result(res: PyResult, vm: &VirtualMachine) -> PyResult<Self> { |
| 445 | match res { |
no test coverage detected