@@ -985,6 +985,27 @@ def test_using_one_predict_parameter_into_predict_but_not_in_fit() -> None:
985985 mapie_fitted .predict (X_test , ** predict_params )
986986
987987
988+ def test_using_one_predict_parameter_into_fit_but_not_in_predict () -> None :
989+ """Test that using predict parameters in the fit method
990+ without using one predict_parameter in
991+ the predict method raises an error"""
992+ custom_gbr = CustomGradientBoostingRegressor (random_state = random_state )
993+ X_train , X_test , y_train , y_test = (
994+ train_test_split (X , y , test_size = 0.2 , random_state = random_state )
995+ )
996+ mapie = MapieRegressor (estimator = custom_gbr )
997+ predict_params = {'check_predict_params' : True }
998+ mapie_fitted = mapie .fit (X_train , y_train , predict_params = predict_params )
999+
1000+ with pytest .raises (ValueError , match = (
1001+ r"Using one 'predict_param' in the fit method "
1002+ r"without using one 'predict_param' in the predict method. "
1003+ r"Please ensure one 'predict_param' "
1004+ r"is used in the predict method before calling it."
1005+ )):
1006+ mapie_fitted .predict (X_test )
1007+
1008+
9881009def test_predict_infinite_intervals () -> None :
9891010 """Test that MapieRegressor produces infinite bounds with alpha=0"""
9901011 mapie_reg = MapieRegressor ().fit (X , y )
0 commit comments