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

Function test_pyfunction_multiple_warnings

tests/test_pyfunction.rs:775–808  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

773
774#[test]
775fn test_pyfunction_multiple_warnings() {
776 #[pyfunction]
777 #[pyo3(warn(message = "TPMW: this function raises warning"))]
778 #[pyo3(warn(message = "TPMW: this function raises FutureWarning", category = PyFutureWarning))]
779 fn function_with_multiple_warnings() {}
780
781 py_expect_warning_for_fn!(
782 function_with_multiple_warnings,
783 f,
784 [
785 ("TPMW: this function raises warning", PyUserWarning),
786 ("TPMW: this function raises FutureWarning", PyFutureWarning)
787 ]
788 );
789
790 #[cfg(not(Py_LIMITED_API))]
791 #[pyfunction]
792 #[pyo3(warn(message = "TPMW: this function raises FutureWarning", category = PyFutureWarning))]
793 #[pyo3(warn(message = "TPMW: this function raises user-defined warning", category = UserDefinedWarning))]
794 fn function_with_multiple_custom_warnings() {}
795
796 #[cfg(not(Py_LIMITED_API))]
797 py_expect_warning_for_fn!(
798 function_with_multiple_custom_warnings,
799 f,
800 [
801 ("TPMW: this function raises FutureWarning", PyFutureWarning),
802 (
803 "TPMW: this function raises user-defined warning",
804 UserDefinedWarning
805 )
806 ]
807 );
808}
809
810#[test]
811#[cfg(any(not(PyPy), Py_3_12))]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected