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

Function test_pyfunction_raw_ident

tests/test_pyfunction.rs:680–704  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

678
679#[test]
680fn test_pyfunction_raw_ident() {
681 #[pyfunction]
682 fn r#struct() -> bool {
683 true
684 }
685
686 #[pyfunction]
687 #[pyo3(name = "r#enum")]
688 fn raw_ident() -> bool {
689 true
690 }
691
692 #[pymodule]
693 fn m(m: &Bound<'_, PyModule>) -> PyResult<()> {
694 m.add_function(wrap_pyfunction!(r#struct, m)?)?;
695 m.add_function(wrap_pyfunction!(raw_ident, m)?)?;
696 Ok(())
697 }
698
699 Python::attach(|py| {
700 let m = pyo3::wrap_pymodule!(m)(py);
701 py_assert!(py, m, "m.struct()");
702 py_assert!(py, m, "m.enum()");
703 })
704}
705
706#[cfg(any(not(Py_LIMITED_API), Py_3_12))]
707#[pyclass(extends=PyWarning)]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected