@pytest.mark.parametrize('Est', (HalvingGridSearchCV, HalvingRandomSearchCV))
@pytest.mark.parametrize('params, expected_error_message', [({'scoring': {'accuracy', 'accuracy'}}, 'Multimetric scoring is not supported'), ({'resource': 'not_a_parameter'}, 'Cannot use resource=not_a_parameter which is not supported'), ({'resource': 'a', 'max_resources': 100}, 'Cannot use parameter a as the resource since it is part of'), ({'max_resources': 'not_auto'}, 'max_resources must be either'), ({'max_resources': 100.5}, 'max_resources must be either'), ({'max_resources': (- 10)}, 'max_resources must be either'), ({'min_resources': 'bad str'}, 'min_resources must be either'), ({'min_resources': 0.5}, 'min_resources must be either'), ({'min_resources': (- 10)}, 'min_resources must be either'), ({'max_resources': 'auto', 'resource': 'b'}, "max_resources can only be 'auto' if resource='n_samples'"), ({'min_resources': 15, 'max_resources': 14}, 'min_resources_=15 is greater than max_resources_=14'), ({'cv': KFold(shuffle=True)}, 'must yield consistent folds'), ({'cv': ShuffleSplit()}, 'must yield consistent folds'), ({'refit': 'whatever'}, 'refit is expected to be a boolean')])
def test_input_errors(Est, params, expected_error_message):
    base_estimator = FastClassifier()
    param_grid = {'a': [1]}
    (X, y) = make_classification(100)
    sh = Est(base_estimator, param_grid, **params)
    with pytest.raises(ValueError, match=expected_error_message):
        sh.fit(X, y)
@pytest.mark.parametrize('Est', (HalvingGridSearchCV, HalvingRandomSearchCV))
@pytest.mark.parametrize('params, expected_error_message', [({'scoring': {'accuracy', 'accuracy'}}, 'Multimetric scoring is not supported'), ({'resource': 'not_a_parameter'}, 'Cannot use resource=not_a_parameter which is not supported'), ({'resource': 'a', 'max_resources': 100}, 'Cannot use parameter a as the resource since it is part of'), ({'max_resources': 'not_auto'}, 'max_resources must be either'), ({'max_resources': 100.5}, 'max_resources must be either'), ({'max_resources': (- 10)}, 'max_resources must be either'), ({'min_resources': 'bad str'}, 'min_resources must be either'), ({'min_resources': 0.5}, 'min_resources must be either'), ({'min_resources': (- 10)}, 'min_resources must be either'), ({'max_resources': 'auto', 'resource': 'b'}, "max_resources can only be 'auto' if resource='n_samples'"), ({'min_resources': 15, 'max_resources': 14}, 'min_resources_=15 is greater than max_resources_=14'), ({'cv': KFold(shuffle=True)}, 'must yield consistent folds'), ({'cv': ShuffleSplit()}, 'must yield consistent folds'), ({'refit': 'whatever'}, 'refit is expected to be a boolean')])
def test_input_errors(Est, params, expected_error_message):
    base_estimator = FastClassifier()
    param_grid = {'a': [1]}
    (X, y) = make_classification(100)
    sh = Est(base_estimator, param_grid, **params)
    with pytest.raises(ValueError, match=expected_error_message):
        sh.fit(X, y)