pyo3/tests/ui/deprecations.rs

47 lines
796 B
Rust
Raw Normal View History

#![deny(deprecated)]
use pyo3::prelude::*;
#[pyclass]
#[text_signature = "()"]
struct TestClass {
num: u32,
}
#[pymethods]
impl TestClass {
#[classattr]
#[name = "num"]
const DEPRECATED_NAME_CONSTANT: i32 = 0;
#[name = "num"]
#[text_signature = "()"]
fn deprecated_name_pymethod(&self) { }
#[staticmethod]
#[name = "custom_static"]
#[text_signature = "()"]
fn deprecated_name_staticmethod() {}
}
#[pyfunction]
#[name = "foo"]
#[text_signature = "()"]
fn deprecated_name_pyfunction() { }
2021-05-16 09:41:59 +00:00
#[pymodule]
fn my_module(_py: Python, m: &PyModule) -> PyResult<()> {
#[pyfn(m, "some_name")]
#[text_signature = "()"]
2021-05-16 09:41:59 +00:00
fn deprecated_name_pyfn() { }
Ok(())
}
fn main() {
}
// TODO: ensure name deprecated on #[pyfunction] and #[pymodule]