Skip to content

Commit 02b54eb

Browse files
authored
make warning name distinct in warnings tests (#5532)
1 parent 999ee8a commit 02b54eb

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

tests/test_pyfunction.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -669,52 +669,52 @@ impl UserDefinedWarning {
669669
#[test]
670670
fn test_pyfunction_warn() {
671671
#[pyfunction]
672-
#[pyo3(warn(message = "this function raises warning"))]
672+
#[pyo3(warn(message = "TPW: this function raises warning"))]
673673
fn function_with_warning() {}
674674

675675
py_expect_warning_for_fn!(
676676
function_with_warning,
677677
f,
678-
[("this function raises warning", PyUserWarning)]
678+
[("TPW: this function raises warning", PyUserWarning)]
679679
);
680680

681681
#[pyfunction]
682-
#[pyo3(warn(message = "this function raises warning with category", category = PyFutureWarning))]
682+
#[pyo3(warn(message = "TPW: this function raises warning with category", category = PyFutureWarning))]
683683
fn function_with_warning_with_category() {}
684684

685685
py_expect_warning_for_fn!(
686686
function_with_warning_with_category,
687687
f,
688688
[(
689-
"this function raises warning with category",
689+
"TPW: this function raises warning with category",
690690
PyFutureWarning
691691
)]
692692
);
693693

694694
#[pyfunction]
695-
#[pyo3(warn(message = "custom deprecated category", category = pyo3::exceptions::PyDeprecationWarning))]
695+
#[pyo3(warn(message = "TPW: custom deprecated category", category = pyo3::exceptions::PyDeprecationWarning))]
696696
fn function_with_warning_with_custom_category() {}
697697

698698
py_expect_warning_for_fn!(
699699
function_with_warning_with_custom_category,
700700
f,
701701
[(
702-
"custom deprecated category",
702+
"TPW: custom deprecated category",
703703
pyo3::exceptions::PyDeprecationWarning
704704
)]
705705
);
706706

707707
#[cfg(not(Py_LIMITED_API))]
708708
#[pyfunction]
709-
#[pyo3(warn(message = "this function raises user-defined warning", category = UserDefinedWarning))]
709+
#[pyo3(warn(message = "TPW: this function raises user-defined warning", category = UserDefinedWarning))]
710710
fn function_with_warning_and_user_defined_category() {}
711711

712712
#[cfg(not(Py_LIMITED_API))]
713713
py_expect_warning_for_fn!(
714714
function_with_warning_and_user_defined_category,
715715
f,
716716
[(
717-
"this function raises user-defined warning",
717+
"TPW: this function raises user-defined warning",
718718
UserDefinedWarning
719719
)]
720720
);
@@ -723,33 +723,33 @@ fn test_pyfunction_warn() {
723723
#[test]
724724
fn test_pyfunction_multiple_warnings() {
725725
#[pyfunction]
726-
#[pyo3(warn(message = "this function raises warning"))]
727-
#[pyo3(warn(message = "this function raises FutureWarning", category = PyFutureWarning))]
726+
#[pyo3(warn(message = "TPMW: this function raises warning"))]
727+
#[pyo3(warn(message = "TPMW: this function raises FutureWarning", category = PyFutureWarning))]
728728
fn function_with_multiple_warnings() {}
729729

730730
py_expect_warning_for_fn!(
731731
function_with_multiple_warnings,
732732
f,
733733
[
734-
("this function raises warning", PyUserWarning),
735-
("this function raises FutureWarning", PyFutureWarning)
734+
("TPMW: this function raises warning", PyUserWarning),
735+
("TPMW: this function raises FutureWarning", PyFutureWarning)
736736
]
737737
);
738738

739739
#[cfg(not(Py_LIMITED_API))]
740740
#[pyfunction]
741-
#[pyo3(warn(message = "this function raises FutureWarning", category = PyFutureWarning))]
742-
#[pyo3(warn(message = "this function raises user-defined warning", category = UserDefinedWarning))]
741+
#[pyo3(warn(message = "TPMW: this function raises FutureWarning", category = PyFutureWarning))]
742+
#[pyo3(warn(message = "TPMW: this function raises user-defined warning", category = UserDefinedWarning))]
743743
fn function_with_multiple_custom_warnings() {}
744744

745745
#[cfg(not(Py_LIMITED_API))]
746746
py_expect_warning_for_fn!(
747747
function_with_multiple_custom_warnings,
748748
f,
749749
[
750-
("this function raises FutureWarning", PyFutureWarning),
750+
("TPMW: this function raises FutureWarning", PyFutureWarning),
751751
(
752-
"this function raises user-defined warning",
752+
"TPMW: this function raises user-defined warning",
753753
UserDefinedWarning
754754
)
755755
]

0 commit comments

Comments
 (0)