From 03980488eeb267557466af051011ff9e287a4b82 Mon Sep 17 00:00:00 2001 From: "Simon P. Couch" Date: Mon, 4 Mar 2024 12:50:16 -0600 Subject: [PATCH] skip snapshots with `glue()` error on R 4.3.3+ (#210) * skip snapshots with `glue()` error on R 4.3.3+ * update snaps for survival/finetune --- .../_snaps/survival-tune_race_anova.md | 30 +++++++++---------- tests/testthat/test-glmnet-linear.R | 2 +- tests/testthat/test-glmnet-logistic.R | 2 +- tests/testthat/test-glmnet-multinom.R | 2 +- tests/testthat/test-glmnet-poisson.R | 1 + 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/tests/testthat/_snaps/survival-tune_race_anova.md b/tests/testthat/_snaps/survival-tune_race_anova.md index 0de7f846..572af7ae 100644 --- a/tests/testthat/_snaps/survival-tune_race_anova.md +++ b/tests/testthat/_snaps/survival-tune_race_anova.md @@ -42,11 +42,11 @@ # A tibble: 5 x 6 cost_complexity .metric .eval_time mean n std_err - 1 0.0000000001 brier_survival 1 0.177 30 0.00707 - 2 0.0841 brier_survival 1 0.201 30 0.00415 - 3 0.0891 brier_survival 1 0.201 30 0.00415 - 4 0.0944 brier_survival 1 0.201 30 0.00415 - 5 0.1 brier_survival 1 0.201 30 0.00415 + 1 0.0841 brier_survival 1 0.201 30 0.00415 + 2 0.0891 brier_survival 1 0.201 30 0.00415 + 3 0.0944 brier_survival 1 0.201 30 0.00415 + 4 0.1 brier_survival 1 0.201 30 0.00415 + 5 0.0794 brier_survival 1 0.202 30 0.00418 --- @@ -69,11 +69,11 @@ # A tibble: 5 x 6 cost_complexity .metric .eval_time mean n std_err - 1 0.0000000001 brier_survival 1 0.177 30 0.00707 - 2 0.0841 brier_survival 1 0.201 30 0.00415 - 3 0.0891 brier_survival 1 0.201 30 0.00415 - 4 0.0944 brier_survival 1 0.201 30 0.00415 - 5 0.1 brier_survival 1 0.201 30 0.00415 + 1 0.0841 brier_survival 1 0.201 30 0.00415 + 2 0.0891 brier_survival 1 0.201 30 0.00415 + 3 0.0944 brier_survival 1 0.201 30 0.00415 + 4 0.1 brier_survival 1 0.201 30 0.00415 + 5 0.0794 brier_survival 1 0.202 30 0.00418 --- @@ -87,11 +87,11 @@ # A tibble: 5 x 6 cost_complexity .metric .eval_time mean n std_err - 1 0.0000000001 brier_survival_integrated NA 0.285 30 0.00426 - 2 0.0794 brier_survival_integrated NA 0.338 30 0.00487 - 3 0.0841 brier_survival_integrated NA 0.338 30 0.00480 - 4 0.0891 brier_survival_integrated NA 0.338 30 0.00480 - 5 0.0944 brier_survival_integrated NA 0.338 30 0.00480 + 1 0.0794 brier_survival_integrated NA 0.338 30 0.00487 + 2 0.0841 brier_survival_integrated NA 0.338 30 0.00480 + 3 0.0891 brier_survival_integrated NA 0.338 30 0.00480 + 4 0.0944 brier_survival_integrated NA 0.338 30 0.00480 + 5 0.1 brier_survival_integrated NA 0.338 30 0.00480 # race tuning (anova) - unneeded eval_time diff --git a/tests/testthat/test-glmnet-linear.R b/tests/testthat/test-glmnet-linear.R index 9493e8fe..34b19f48 100644 --- a/tests/testthat/test-glmnet-linear.R +++ b/tests/testthat/test-glmnet-linear.R @@ -265,6 +265,7 @@ test_that('multi_predict() with default or single penalty value', { test_that('error traps', { skip_if_not_installed("glmnet") + skip_if_not_installed("parsnip", minimum_version = "1.2.0.9001") expect_snapshot(error = TRUE, { linear_reg(penalty = 0.01) %>% @@ -277,7 +278,6 @@ test_that('error traps', { set_engine("glmnet") %>% fit(mpg ~ ., data = mtcars[-(1:4), ]) }) - skip_if_not_installed("parsnip", minimum_version = "1.0.4.9003") expect_snapshot(error = TRUE, { linear_reg(penalty = 0.01) %>% set_engine("glmnet") %>% diff --git a/tests/testthat/test-glmnet-logistic.R b/tests/testthat/test-glmnet-logistic.R index 0f97f81c..93f8a4f0 100644 --- a/tests/testthat/test-glmnet-logistic.R +++ b/tests/testthat/test-glmnet-logistic.R @@ -377,6 +377,7 @@ test_that("class predictions are factors with all levels", { test_that('error traps', { skip_if_not_installed("glmnet") + skip_if_not_installed("parsnip", minimum_version = "1.2.0.9001") data("lending_club", package = "modeldata", envir = rlang::current_env()) @@ -393,7 +394,6 @@ test_that('error traps', { fit(Class ~ log(funded_amnt) + int_rate + term, data = lending_club) }) - skip_if_not_installed("parsnip", minimum_version = "1.0.4.9003") expect_snapshot(error = TRUE, { logistic_reg(penalty = 0.01) %>% set_engine("glmnet") %>% diff --git a/tests/testthat/test-glmnet-multinom.R b/tests/testthat/test-glmnet-multinom.R index fcc55a67..47ebd126 100644 --- a/tests/testthat/test-glmnet-multinom.R +++ b/tests/testthat/test-glmnet-multinom.R @@ -399,6 +399,7 @@ test_that("class predictions are factors with all levels", { test_that('error traps', { skip_if_not_installed("glmnet") + skip_if_not_installed("parsnip", minimum_version = "1.2.0.9001") data("hpc_data", package = "modeldata", envir = rlang::current_env()) @@ -413,7 +414,6 @@ test_that('error traps', { set_engine("glmnet") %>% fit(class ~ ., data = hpc_data) }) - skip_if_not_installed("parsnip", minimum_version = "1.0.4.9003") expect_snapshot(error = TRUE, { multinom_reg(penalty = 0.01) %>% set_engine("glmnet") %>% diff --git a/tests/testthat/test-glmnet-poisson.R b/tests/testthat/test-glmnet-poisson.R index aa425254..987d49bd 100644 --- a/tests/testthat/test-glmnet-poisson.R +++ b/tests/testthat/test-glmnet-poisson.R @@ -134,6 +134,7 @@ test_that("model errors on missing penalty value", { test_that("predict() errors with multiple penalty values", { skip_if_not_installed("glmnet") + skip_if_not_installed("parsnip", minimum_version = "1.2.0.9001") skip_if_not_installed("poissonreg", minimum_version = "1.0.1.9000") expect_snapshot(error = TRUE, {