diff --git a/tests/testthat/_snaps/lightgbm.md b/tests/testthat/_snaps/lightgbm.md index b834e65..d7a1866 100644 --- a/tests/testthat/_snaps/lightgbm.md +++ b/tests/testthat/_snaps/lightgbm.md @@ -46,7 +46,7 @@ bill_length_mm ~ ., data = penguins) Condition Warning: - The following arguments cannot be manually modified and were removed: feature_fraction_bynode. + The argument `feature_fraction_bynode` cannot be manually modified and was removed. Error: ! The supplied argument `mtry = 0.5` must be greater than or equal to 1. @@ -65,6 +65,34 @@ # training wrapper warns on protected arguments + Code + .res <- boost_tree() %>% set_engine("lightgbm", colnames = paste0("X", 1:ncol( + penguins))) %>% set_mode("regression") %>% fit(bill_length_mm ~ ., data = penguins) + Condition + Warning: + The following argument(s) are guarded by bonsai and will not be passed to LightGBM: colnames + +--- + + Code + .res <- boost_tree() %>% set_engine("lightgbm", colnames = paste0("X", 1:ncol( + penguins)), callbacks = list(p = print)) %>% set_mode("regression") %>% fit( + bill_length_mm ~ ., data = penguins) + Condition + Warning: + The following argument(s) are guarded by bonsai and will not be passed to LightGBM: colnames, callbacks + +--- + + Code + .res <- boost_tree() %>% set_engine("lightgbm", colnames = paste0("X", 1:ncol( + penguins))) %>% set_mode("regression") %>% fit(bill_length_mm ~ ., data = penguins) + Condition + Warning: + The following argument(s) are guarded by bonsai and will not be passed to LightGBM: colnames + +--- + Code boost_tree() %>% set_engine("lightgbm", n_iter = 10) %>% set_mode("regression") %>% fit(bill_length_mm ~ ., data = penguins) diff --git a/tests/testthat/test-lightgbm.R b/tests/testthat/test-lightgbm.R index 8f5cd7c..e99c0f5 100644 --- a/tests/testthat/test-lightgbm.R +++ b/tests/testthat/test-lightgbm.R @@ -515,35 +515,33 @@ test_that("training wrapper warns on protected arguments", { penguins <- penguins[complete.cases(penguins),] - expect_warning( - boost_tree() %>% + expect_snapshot( + .res <- boost_tree() %>% set_engine("lightgbm", colnames = paste0("X", 1:ncol(penguins))) %>% set_mode("regression") %>% - fit(bill_length_mm ~ ., data = penguins), - "guarded by bonsai.*colnames" + fit(bill_length_mm ~ ., data = penguins) ) - expect_warning( - boost_tree() %>% + expect_snapshot( + .res <- boost_tree() %>% set_engine( "lightgbm", colnames = paste0("X", 1:ncol(penguins)), callbacks = list(p = print) ) %>% set_mode("regression") %>% - fit(bill_length_mm ~ ., data = penguins), - "guarded by bonsai.*colnames, callbacks" + fit(bill_length_mm ~ ., data = penguins) ) - expect_warning( - boost_tree() %>% + expect_snapshot( + .res <- + boost_tree() %>% set_engine( "lightgbm", colnames = paste0("X", 1:ncol(penguins)) ) %>% set_mode("regression") %>% - fit(bill_length_mm ~ ., data = penguins), - "guarded by bonsai.*colnames" + fit(bill_length_mm ~ ., data = penguins) ) expect_snapshot(