MCPcopy Create free account
hub / github.com/PyO3/pyo3 / test_function_with_custom_conversion

Function test_function_with_custom_conversion

tests/test_pyfunction.rs:220–235  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

218
219#[test]
220fn test_function_with_custom_conversion() {
221 Python::attach(|py| {
222 let custom_conv_func = wrap_pyfunction!(function_with_custom_conversion)(py).unwrap();
223
224 pyo3::py_run!(
225 py,
226 custom_conv_func,
227 r#"
228 import datetime
229
230 dt = datetime.datetime.fromtimestamp(1612040400)
231 assert custom_conv_func(dt) == 1612040400
232 "#
233 )
234 });
235}
236
237#[test]
238fn test_function_with_custom_conversion_error() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected