Skip to content

Commit ab47c61

Browse files
committed
add test to check for list of estimators for cv prefit
1 parent 6c973b0 commit ab47c61

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

mapie/tests/test_utils.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,3 +298,23 @@ def test_compute_quantiles_2D_and_3D(alphas: NDArray):
298298
quantiles2 = compute_quantiles(vector2, alphas)
299299

300300
assert (quantiles1 == quantiles2).all()
301+
302+
303+
@pytest.mark.parametrize("estimator", [-1, 3, 0.2])
304+
def test_quantile_prefit_non_iterable(estimator: Any) -> None:
305+
"""
306+
Test that there is a list of estimators provided when cv='prefit'
307+
is called for MapieQuantileRegressor.
308+
"""
309+
with pytest.raises(
310+
ValueError,
311+
match=r".*Estimator for prefit must be an iterable object.*",
312+
):
313+
mapie_reg = MapieQuantileRegressor(
314+
estimator=estimator,
315+
cv="prefit"
316+
)
317+
mapie_reg.fit(
318+
[1, 2, 3],
319+
[4, 5, 6]
320+
)

0 commit comments

Comments
 (0)