Skip to content

Commit 1e9b262

Browse files
authored
update snaps with parsnip cli error formatting (#219)
* update snaps with parsnip cli error formatting * bump minimum parsnip version
1 parent d575e4e commit 1e9b262

File tree

8 files changed

+29
-25
lines changed

8 files changed

+29
-25
lines changed

tests/testthat/_snaps/glmnet-linear.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@
55
-(1:4), ]) %>% predict(mtcars[-(1:4), ], penalty = 0:1)
66
Condition
77
Error in `.check_glmnet_penalty_predict()`:
8-
! `penalty` should be a single numeric value. `multi_predict()` can be used to get multiple predictions per row of data.
8+
! `penalty` should be a single numeric value.
9+
i `multi_predict()` can be used to get multiple predictions per row of data.
910

1011
---
1112

1213
Code
1314
linear_reg() %>% set_engine("glmnet") %>% fit(mpg ~ ., data = mtcars[-(1:4), ])
1415
Condition
1516
Error in `.check_glmnet_penalty_fit()`:
16-
! For the glmnet engine, `penalty` must be a single number (or a value of `tune()`).
17-
* There are 0 values for `penalty`.
18-
* To try multiple values for total regularization, use the tune package.
19-
* To predict multiple penalties, use `multi_predict()`
17+
x For the glmnet engine, `penalty` must be a single number (or a value of `tune()`).
18+
! There are 0 values for `penalty`.
19+
i To try multiple values for total regularization, use the tune package.
20+
i To predict multiple penalties, use `multi_predict()`.
2021

2122
---
2223

tests/testthat/_snaps/glmnet-logistic.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
penalty = 0:1)
1515
Condition
1616
Error in `.check_glmnet_penalty_predict()`:
17-
! `penalty` should be a single numeric value. `multi_predict()` can be used to get multiple predictions per row of data.
17+
! `penalty` should be a single numeric value.
18+
i `multi_predict()` can be used to get multiple predictions per row of data.
1819

1920
---
2021

@@ -23,10 +24,10 @@
2324
int_rate + term, data = lending_club)
2425
Condition
2526
Error in `.check_glmnet_penalty_fit()`:
26-
! For the glmnet engine, `penalty` must be a single number (or a value of `tune()`).
27-
* There are 0 values for `penalty`.
28-
* To try multiple values for total regularization, use the tune package.
29-
* To predict multiple penalties, use `multi_predict()`
27+
x For the glmnet engine, `penalty` must be a single number (or a value of `tune()`).
28+
! There are 0 values for `penalty`.
29+
i To try multiple values for total regularization, use the tune package.
30+
i To predict multiple penalties, use `multi_predict()`.
3031

3132
---
3233

tests/testthat/_snaps/glmnet-multinom.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,19 @@
1313
predict(hpc_data, penalty = 0:1)
1414
Condition
1515
Error in `.check_glmnet_penalty_predict()`:
16-
! `penalty` should be a single numeric value. `multi_predict()` can be used to get multiple predictions per row of data.
16+
! `penalty` should be a single numeric value.
17+
i `multi_predict()` can be used to get multiple predictions per row of data.
1718

1819
---
1920

2021
Code
2122
multinom_reg() %>% set_engine("glmnet") %>% fit(class ~ ., data = hpc_data)
2223
Condition
2324
Error in `.check_glmnet_penalty_fit()`:
24-
! For the glmnet engine, `penalty` must be a single number (or a value of `tune()`).
25-
* There are 0 values for `penalty`.
26-
* To try multiple values for total regularization, use the tune package.
27-
* To predict multiple penalties, use `multi_predict()`
25+
x For the glmnet engine, `penalty` must be a single number (or a value of `tune()`).
26+
! There are 0 values for `penalty`.
27+
i To try multiple values for total regularization, use the tune package.
28+
i To predict multiple penalties, use `multi_predict()`.
2829

2930
---
3031

tests/testthat/_snaps/glmnet-poisson.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
poisson_reg() %>% set_engine("glmnet") %>% fit(mpg ~ ., data = mtcars[-(1:4), ])
55
Condition
66
Error in `.check_glmnet_penalty_fit()`:
7-
! For the glmnet engine, `penalty` must be a single number (or a value of `tune()`).
8-
* There are 0 values for `penalty`.
9-
* To try multiple values for total regularization, use the tune package.
10-
* To predict multiple penalties, use `multi_predict()`
7+
x For the glmnet engine, `penalty` must be a single number (or a value of `tune()`).
8+
! There are 0 values for `penalty`.
9+
i To try multiple values for total regularization, use the tune package.
10+
i To predict multiple penalties, use `multi_predict()`.
1111

1212
# predict() errors with multiple penalty values
1313

@@ -16,5 +16,6 @@
1616
-(1:4), ]) %>% predict(mtcars[-(1:4), ], penalty = 0:1)
1717
Condition
1818
Error in `.check_glmnet_penalty_predict()`:
19-
! `penalty` should be a single numeric value. `multi_predict()` can be used to get multiple predictions per row of data.
19+
! `penalty` should be a single numeric value.
20+
i `multi_predict()` can be used to get multiple predictions per row of data.
2021

tests/testthat/test-glmnet-linear.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ test_that('multi_predict() with default or single penalty value', {
265265

266266
test_that('error traps', {
267267
skip_if_not_installed("glmnet")
268-
skip_if_not_installed("parsnip", minimum_version = "1.2.0.9001")
268+
skip_if_not_installed("parsnip", minimum_version = "1.2.1.9001")
269269

270270
expect_snapshot(error = TRUE, {
271271
linear_reg(penalty = 0.01) %>%

tests/testthat/test-glmnet-logistic.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ test_that("class predictions are factors with all levels", {
377377

378378
test_that('error traps', {
379379
skip_if_not_installed("glmnet")
380-
skip_if_not_installed("parsnip", minimum_version = "1.2.0.9001")
380+
skip_if_not_installed("parsnip", minimum_version = "1.2.1.9001")
381381

382382
data("lending_club", package = "modeldata", envir = rlang::current_env())
383383

tests/testthat/test-glmnet-multinom.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ test_that("class predictions are factors with all levels", {
399399

400400
test_that('error traps', {
401401
skip_if_not_installed("glmnet")
402-
skip_if_not_installed("parsnip", minimum_version = "1.2.0.9001")
402+
skip_if_not_installed("parsnip", minimum_version = "1.2.1.9001")
403403

404404
data("hpc_data", package = "modeldata", envir = rlang::current_env())
405405

tests/testthat/test-glmnet-poisson.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ test_that("formula interface can deal with missing values", {
124124
test_that("model errors on missing penalty value", {
125125
skip_if_not_installed("glmnet")
126126

127-
skip_if_not_installed("parsnip", minimum_version = "1.0.3.9000")
127+
skip_if_not_installed("parsnip", minimum_version = "1.2.1.9001")
128128
expect_snapshot(error = TRUE, {
129129
poisson_reg() %>%
130130
set_engine("glmnet") %>%
@@ -134,7 +134,7 @@ test_that("model errors on missing penalty value", {
134134

135135
test_that("predict() errors with multiple penalty values", {
136136
skip_if_not_installed("glmnet")
137-
skip_if_not_installed("parsnip", minimum_version = "1.2.0.9001")
137+
skip_if_not_installed("parsnip", minimum_version = "1.2.1.9001")
138138

139139
skip_if_not_installed("poissonreg", minimum_version = "1.0.1.9000")
140140
expect_snapshot(error = TRUE, {

0 commit comments

Comments
 (0)