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

Function test_wrap_pyfunction_forms

src/impl_/pyfunction.rs:138–165  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

136mod tests {
137 #[test]
138 fn test_wrap_pyfunction_forms() {
139 use crate::types::{PyAnyMethods, PyModule};
140 use crate::{Python, wrap_pyfunction};
141
142 #[crate::pyfunction(crate = "crate")]
143 fn f() {}
144
145 Python::attach(|py| {
146 let module = PyModule::new(py, "test_wrap_pyfunction_forms").unwrap();
147
148 let func = wrap_pyfunction!(f, module.clone()).unwrap();
149 func.call0().unwrap();
150
151 let func = wrap_pyfunction!(f, &module).unwrap();
152 func.call0().unwrap();
153
154 let module_borrowed = module.as_borrowed();
155
156 let func = wrap_pyfunction!(f, module_borrowed).unwrap();
157 func.call0().unwrap();
158
159 let func = wrap_pyfunction!(f, &module_borrowed).unwrap();
160 func.call0().unwrap();
161
162 let func = wrap_pyfunction!(f, py).unwrap();
163 func.call0().unwrap();
164 });
165 }
166}

Callers

nothing calls this directly

Calls 2

as_borrowedMethod · 0.80
call0Method · 0.45

Tested by

no test coverage detected