tidymodels / parsnip

A tidy unified interface to models
https://parsnip.tidymodels.org
Other
564 stars 78 forks source link

expect_error() is being used too much #1096

Open EmilHvitfeldt opened 3 months ago

EmilHvitfeldt commented 3 months ago

as an example the following test https://github.com/tidymodels/parsnip/blob/main/tests/testthat/test_decision_tree.R#L15-L18

  expect_snapshot_error({
    bt <- decision_tree(cost_complexity = -1) %>% set_engine("rpart")
    fit(bt, class ~ ., hpc)
  })

is expected to test that cost_complexity isn’t good, but it instead tests that the mode isn’t set

#> Error in `fit()`:
#> ! Please set the mode in the model specification.