Skip to content

Commit

Permalink
UPD: change gamma value error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Thibault Cordier committed Dec 21, 2023
1 parent 4bf1da2 commit e8c2ba4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 4 additions & 1 deletion mapie/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,10 @@ def test_valid_gamma(gamma: float) -> None:
@pytest.mark.parametrize("gamma", [1.5, -0.1])
def test_invalid_large_gamma(gamma: float) -> None:
"""Test a non-valid gamma parameter."""
with pytest.raises(ValueError, match="Gamma must be between 0 and 1."):
with pytest.raises(
ValueError,
match="Invalid gamma. Allowed values are between 0 and 1."
):
check_gamma(gamma)


Expand Down
5 changes: 2 additions & 3 deletions mapie/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def check_gamma(
gamma: float
) -> None:
"""
Check if gamma is between 0 and 1
Check if gamma is between 0 and 1.
Parameters
----------
Expand All @@ -379,10 +379,9 @@ def check_gamma(
ValueError
If gamma is lower than 0 or higher than 1.
"""

if (gamma < 0) or (gamma > 1):
raise ValueError(
"Gamma must be between 0 and 1."
"Invalid gamma. Allowed values are between 0 and 1."
)


Expand Down

0 comments on commit e8c2ba4

Please sign in to comment.