Skip to content

Commit 13bc6c7

Browse files
committed
add test accordingly
1 parent ef1f2cf commit 13bc6c7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

mapie/tests/risk_control/test_precision_recall_control.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,3 +784,19 @@ def test_method_none_recall() -> None:
784784
)
785785
mapie_clf.calibrate(X_toy, y_toy)
786786
assert mapie_clf.method == "crc"
787+
788+
789+
def test_compute_best_predict_param_invalid_risk():
790+
"""
791+
Test that compute_best_predict_param raises error for an unsupported risk value.
792+
"""
793+
mapie_clf = MultiLabelClassificationController(
794+
predict_function=toy_predict_function, risk="recall"
795+
)
796+
mapie_clf.compute_risks(X_toy, y_toy)
797+
mapie_clf._risk = "false_pos_rate"
798+
with pytest.raises(
799+
NotImplementedError,
800+
match=r".*risk not implemented.*",
801+
):
802+
mapie_clf.compute_best_predict_param()

0 commit comments

Comments
 (0)