2023-06-05 10:33:17 +00:00
|
|
|
#![cfg(feature = "macros")]
|
|
|
|
|
2021-07-30 23:21:13 +00:00
|
|
|
use pyo3::prelude::*;
|
|
|
|
use pyo3::types::IntoPyDict;
|
|
|
|
|
|
|
|
#[macro_use]
|
2023-09-24 12:34:53 +00:00
|
|
|
#[path = "../src/tests/common.rs"]
|
2021-07-30 23:21:13 +00:00
|
|
|
mod common;
|
|
|
|
|
|
|
|
#[pyclass]
|
|
|
|
/// The MacroDocs class.
|
|
|
|
#[doc = concat!("Some macro ", "class ", "docs.")]
|
|
|
|
/// A very interesting type!
|
|
|
|
struct MacroDocs {}
|
|
|
|
|
|
|
|
#[pymethods]
|
|
|
|
impl MacroDocs {
|
|
|
|
#[doc = concat!("A macro ", "example.")]
|
|
|
|
/// With mixed doc types.
|
|
|
|
fn macro_doc(&self) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn meth_doc() {
|
|
|
|
Python::with_gil(|py| {
|
2024-02-18 18:27:19 +00:00
|
|
|
let d = [("C", py.get_type_bound::<MacroDocs>())].into_py_dict_bound(py);
|
2021-07-30 23:21:13 +00:00
|
|
|
py_assert!(
|
|
|
|
py,
|
|
|
|
*d,
|
|
|
|
"C.__doc__ == 'The MacroDocs class.\\nSome macro class docs.\\nA very interesting type!'"
|
|
|
|
);
|
|
|
|
py_assert!(
|
|
|
|
py,
|
|
|
|
*d,
|
|
|
|
"C.macro_doc.__doc__ == 'A macro example.\\nWith mixed doc types.'"
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|