diff --git a/DESCRIPTION b/DESCRIPTION index c1d9747..751a174 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -43,9 +43,10 @@ Suggests: rsample, scales, snakecase, - testthat (>= 2.1.0), + testthat (>= 3.0.0), tidyr, tune, workflows, yardstick RoxygenNote: 7.2.3 +Config/testthat/edition: 3 diff --git a/tests/testthat/helper-lightgbm.R b/tests/testthat/helper-lightgbm.R index aac56e9..0f1335a 100644 --- a/tests/testthat/helper-lightgbm.R +++ b/tests/testthat/helper-lightgbm.R @@ -102,7 +102,7 @@ expect_can_tune_boost_tree <- function(model) { expect_true(all(!is.nan(tune::collect_metrics(adj)$mean))) final <- model %>% - tune::finalize_model(tune::select_best(adj)) %>% + tune::finalize_model(tune::select_best(adj, metric = "rmse")) %>% parsnip::set_mode("regression") %>% parsnip::fit(mpg ~ ., mtcars) diff --git a/tests/testthat/test-early_stopping.R b/tests/testthat/test-early_stopping.R index 741a0b6..0a61e05 100644 --- a/tests/testthat/test-early_stopping.R +++ b/tests/testthat/test-early_stopping.R @@ -1,5 +1,3 @@ -context("test early stopping") - test_that("validation uses correct dimensions", { expect_error( reg_fit <- diff --git a/tests/testthat/test-helpers.R b/tests/testthat/test-helpers.R index c193b42..3b2d94f 100644 --- a/tests/testthat/test-helpers.R +++ b/tests/testthat/test-helpers.R @@ -1,5 +1,3 @@ -context("test axe_tune_data()") - ##### TEST axe_tune_data() ##### axe_test_data <- dplyr::tibble( @@ -10,7 +8,11 @@ axe_test_data <- dplyr::tibble( # Test for expected outputs test_that("output is as expected", { - expect_equivalent(axe_tune_data(axe_test_data), axe_test_data[, 1:2]) + expect_equal( + axe_tune_data(axe_test_data), + axe_test_data[, 1:2], + ignore_attr = TRUE + ) }) # Test that invalid inputs throw errors @@ -20,8 +22,6 @@ test_that("invalid data types stop process", { }) -context("test axe_recipe()") - ##### TEST axe_recipe() ##### iris_recp <- recipes::recipe( @@ -43,8 +43,6 @@ test_that("invalid data types stop process", { }) -context("test lgbm_save() and lgbm_load()") - ##### TEST lgbm_save() and lgbm_load() ##### library(modeldata) diff --git a/tests/testthat/test-hyperparameters.R b/tests/testthat/test-hyperparameters.R index 16fd3af..24b791e 100644 --- a/tests/testthat/test-hyperparameters.R +++ b/tests/testthat/test-hyperparameters.R @@ -1,5 +1,3 @@ -context("test hyperparameters") - model <- parsnip::boost_tree() %>% parsnip::set_mode("regression") diff --git a/tests/testthat/test-lightgbm.R b/tests/testthat/test-lightgbm.R index dd39493..0896475 100644 --- a/tests/testthat/test-lightgbm.R +++ b/tests/testthat/test-lightgbm.R @@ -1,5 +1,3 @@ -context("test lightgbm regression") - test_that("lightgbm regression", { model <- parsnip::boost_tree(trees = 50) %>% parsnip::set_engine( @@ -123,8 +121,6 @@ test_that("lighgbm throws error", { }) -context("test tune") - test_that("lightgbm with tune", { model <- parsnip::boost_tree( trees = tune::tune()