@@ -4070,37 +4070,30 @@ def check_param_validation(name, estimator_orig):
4070
4070
f"parameter { param_name } does not have a valid type or value."
4071
4071
)
4072
4072
4073
- # If the parameter constraint equals object, the bad parameter
4074
- # doesn't raise an appropriate exception. Object is a placeholder
4075
- # for all kinds of types, that can't be tested properly at the
4076
- # moment, e.g. numpy data types
4077
- # TODO: Remove this, if all data types can be validated correctly
4078
- if estimator_orig ._parameter_constraints [param_name ] != [object ]:
4079
-
4080
- estimator = clone (estimator_orig )
4073
+ estimator = clone (estimator_orig )
4081
4074
4082
- # First, check that the error is raised if param doesn't match any valid
4083
- # type.
4084
- estimator .set_params (** {param_name : param_with_bad_type })
4075
+ # First, check that the error is raised if param doesn't match any valid
4076
+ # type.
4077
+ estimator .set_params (** {param_name : param_with_bad_type })
4085
4078
4086
- for method in methods :
4087
- with raises (ValueError , match = match , err_msg = err_msg ):
4088
- getattr (estimator , method )(X , y )
4079
+ for method in methods :
4080
+ with raises (ValueError , match = match , err_msg = err_msg ):
4081
+ getattr (estimator , method )(X , y )
4089
4082
4090
- # Then, for constraints that are more than a type constraint, check that
4091
- # the error is raised if param does match a valid type but does not match
4092
- # any valid value for this type.
4093
- constraints = estimator_orig ._parameter_constraints [param_name ]
4094
- constraints = [make_constraint (constraint ) for constraint in constraints ]
4083
+ # Then, for constraints that are more than a type constraint, check that
4084
+ # the error is raised if param does match a valid type but does not match
4085
+ # any valid value for this type.
4086
+ constraints = estimator_orig ._parameter_constraints [param_name ]
4087
+ constraints = [make_constraint (constraint ) for constraint in constraints ]
4095
4088
4096
- for constraint in constraints :
4097
- try :
4098
- bad_value = generate_invalid_param_val (constraint , constraints )
4099
- except NotImplementedError :
4100
- continue
4089
+ for constraint in constraints :
4090
+ try :
4091
+ bad_value = generate_invalid_param_val (constraint , constraints )
4092
+ except NotImplementedError :
4093
+ continue
4101
4094
4102
- estimator .set_params (** {param_name : bad_value })
4095
+ estimator .set_params (** {param_name : bad_value })
4103
4096
4104
- for method in methods :
4105
- with raises (ValueError , match = match , err_msg = err_msg ):
4106
- getattr (estimator , method )(X , y )
4097
+ for method in methods :
4098
+ with raises (ValueError , match = match , err_msg = err_msg ):
4099
+ getattr (estimator , method )(X , y )
0 commit comments