From e51463ebe1c70bff5ac440060e93706afe82c2d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98topepo=E2=80=99?= <‘mxkuhn@gmail.com’> Date: Wed, 25 Sep 2024 17:13:45 -0400 Subject: [PATCH] changes from reviewer feedback --- tests/testthat/_snaps/augment.md | 27 ------------- tests/testthat/_snaps/quantile-reg-specs.md | 43 --------------------- tests/testthat/test-augment.R | 15 ------- tests/testthat/test-linear_reg_quantreg.R | 2 - tests/testthat/test-quantile-reg-specs.R | 33 ---------------- 5 files changed, 120 deletions(-) delete mode 100644 tests/testthat/_snaps/quantile-reg-specs.md delete mode 100644 tests/testthat/test-quantile-reg-specs.R diff --git a/tests/testthat/_snaps/augment.md b/tests/testthat/_snaps/augment.md index 5223474be..a2f742e84 100644 --- a/tests/testthat/_snaps/augment.md +++ b/tests/testthat/_snaps/augment.md @@ -10,30 +10,3 @@ Message Quantile levels: 0.2, 0.4, 0.6, 0.8, and 1. ---- - - Code - linear_reg() %>% set_mode("quantile regression", quantile_levels = c(probs_1, - probs_1)) - Condition - Error in `set_mode()`: - ! Quantile levels should be unique. - i The following values were repeated: 0.2, 0.4, 0.6, 0.8, and 1. - ---- - - Code - linear_reg() %>% set_mode("quantile regression", quantile_levels = c(probs_1, - NA)) - Condition - Error in `set_mode()`: - ! `quantile_levels` must be a number, not a numeric `NA`. - ---- - - Code - linear_reg() %>% set_mode("quantile regression") - Condition - Error in `set_mode()`: - ! `quantile_levels` cannot be "NULL". - diff --git a/tests/testthat/_snaps/quantile-reg-specs.md b/tests/testthat/_snaps/quantile-reg-specs.md deleted file mode 100644 index aafb186ea..000000000 --- a/tests/testthat/_snaps/quantile-reg-specs.md +++ /dev/null @@ -1,43 +0,0 @@ -# test mode setting for quantile regression - - Code - linear_reg() %>% set_engine("quantreg") %>% set_mode("regression") - Condition - Error in `set_mode()`: - ! Available modes for engine quantreg are: "unknown" and "quantile regression". - ---- - - Code - linear_reg() %>% set_engine("quantreg") %>% set_mode("quantile regression") - Condition - Error in `set_mode()`: - ! `quantile_levels` cannot be "NULL". - ---- - - Code - linear_reg() %>% set_engine("quantreg") %>% set_mode("quantile regression", - quantile_level = 2) - Condition - Error in `set_mode()`: - ! `quantile_levels` must be a number between 0 and 1, not the number 2. - ---- - - Code - linear_reg() %>% set_engine("quantreg") %>% set_mode("quantile regression", - quantile_level = 1:2) - Condition - Error in `set_mode()`: - ! `quantile_levels` must be a number between 0 and 1, not the number 2. - ---- - - Code - linear_reg() %>% set_engine("quantreg") %>% set_mode("quantile regression", - quantile_level = NA_real_) - Condition - Error in `set_mode()`: - ! `quantile_levels` must be a number, not a numeric `NA`. - diff --git a/tests/testthat/test-augment.R b/tests/testthat/test-augment.R index aa5ab9bd6..d790b3ab4 100644 --- a/tests/testthat/test-augment.R +++ b/tests/testthat/test-augment.R @@ -98,19 +98,4 @@ test_that('quantile regression models', { expect_snapshot( linear_reg() %>% set_mode("quantile regression", quantile_levels = probs_1) ) - - expect_snapshot( - linear_reg() %>% set_mode("quantile regression", quantile_levels = c(probs_1, probs_1)), - error = TRUE - ) - - expect_snapshot( - linear_reg() %>% set_mode("quantile regression", quantile_levels = c(probs_1, NA)), - error = TRUE - ) - - expect_snapshot( - linear_reg() %>% set_mode("quantile regression"), - error = TRUE - ) }) diff --git a/tests/testthat/test-linear_reg_quantreg.R b/tests/testthat/test-linear_reg_quantreg.R index a27c92311..7edc7c3a5 100644 --- a/tests/testthat/test-linear_reg_quantreg.R +++ b/tests/testthat/test-linear_reg_quantreg.R @@ -2,8 +2,6 @@ test_that('linear quantile regression via quantreg - single quantile', { skip_if_not_installed("quantreg") skip_if_not_installed("hardhat", minimum_version = "1.4.0.9002") - library(hardhat) - # data in `helper-objects.R` one_quant <- diff --git a/tests/testthat/test-quantile-reg-specs.R b/tests/testthat/test-quantile-reg-specs.R deleted file mode 100644 index a6070ae3d..000000000 --- a/tests/testthat/test-quantile-reg-specs.R +++ /dev/null @@ -1,33 +0,0 @@ -test_that('test mode setting for quantile regression', { - - expect_snapshot( - linear_reg() %>% - set_engine("quantreg") %>% - set_mode("regression"), - error = TRUE) - - expect_snapshot( - linear_reg() %>% - set_engine("quantreg") %>% - set_mode("quantile regression"), - error = TRUE) - - expect_snapshot( - linear_reg() %>% - set_engine("quantreg") %>% - set_mode("quantile regression", quantile_level = 2), - error = TRUE) - - # TODO this needs to be improved - expect_snapshot( - linear_reg() %>% - set_engine("quantreg") %>% - set_mode("quantile regression", quantile_level = 1:2), - error = TRUE) - - expect_snapshot( - linear_reg() %>% - set_engine("quantreg") %>% - set_mode("quantile regression", quantile_level = NA_real_), - error = TRUE) -})