Skip to content

Commit 22fd445

Browse files
committed
TST test that all default arguments are not mutable
1 parent 613c3af commit 22fd445

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

sklearn/utils/estimator_checks.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from sklearn.utils.testing import assert_raise_message
1818
from sklearn.utils.testing import assert_equal
1919
from sklearn.utils.testing import assert_true
20+
from sklearn.utils.testing import assert_in
2021
from sklearn.utils.testing import assert_array_equal
2122
from sklearn.utils.testing import assert_array_almost_equal
2223
from sklearn.utils.testing import META_ESTIMATORS
@@ -1059,6 +1060,7 @@ def check_parameters_default_constructible(name, Estimator):
10591060
else:
10601061
return
10611062
for arg, default in zip(args, defaults):
1063+
assert_in(type(default), [str, int, float, bool, tuple, type(None)])
10621064
if arg not in params.keys():
10631065
# deprecated parameter, not in get_params
10641066
assert_true(default is None)

0 commit comments

Comments
 (0)