Skip to content

Commit

Permalink
test toggle_sparsity inside fit
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilHvitfeldt committed Jan 17, 2025
1 parent 843de34 commit 138da29
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/testthat/test-sparsevctrs.R
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,22 @@ test_that("toggle_sparsity doesn't change yes", {
"yes"
)
})

test_that("toggle_sparsity doesn't break fit", {
skip_if_not_installed("glmnet")
skip_if_not_installed("modeldata")

data("ames", package = "modeldata")

tree_spec <- parsnip::boost_tree("regression", "xgboost")

rec_spec <- recipes::recipe(Sale_Price ~ ., data = ames) %>%
recipes::step_dummy(recipes::all_nominal_predictors())

wf_spec <- workflow(rec_spec, tree_spec)

expect_no_error(
fit(wf_spec, ames)
)
})

0 comments on commit 138da29

Please sign in to comment.