def test_model_n_trees_invalid(): case_kwargs = copy.deepcopy(toy_kwargs) case_kwargs.update({"n_trees": [42]}) model = CascadeForestClassifier(**case_kwargs) with pytest.raises(ValueError) as excinfo: model._set_n_trees(0) assert "Invalid value for n_trees." in str(excinfo.value)
def test_model_n_trees_non_positive(): case_kwargs = copy.deepcopy(toy_kwargs) case_kwargs.update({"n_trees": 0}) model = CascadeForestClassifier(**case_kwargs) with pytest.raises(ValueError) as excinfo: model._set_n_trees(0) assert "should be strictly positive." in str(excinfo.value)
def test_model_n_trees_auto(): case_kwargs = copy.deepcopy(toy_kwargs) case_kwargs.update({"n_trees": "auto"}) model = CascadeForestClassifier(**case_kwargs) n_trees = model._set_n_trees(0) assert n_trees == 100 n_trees = model._set_n_trees(2) assert n_trees == 300 n_trees = model._set_n_trees(10) assert n_trees == 500