Skip to content

Commit 05c00b6

Browse files
committed
accept tidyselect error snap
1 parent f053382 commit 05c00b6

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

tests/testthat/_snaps/tailor.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,14 @@
9595
! `probabilities` must select at least one column.
9696
x Selector `tidyselect::contains("Class_WRONG")` did not match any columns in `.data`.
9797

98+
---
99+
100+
Code
101+
tailor_fit <- tailor() %>% adjust_numeric_range(0.5) %>% fit(two_class_example,
102+
outcome = "Class1", estimate = ".pred", probabilities = tidyselect::contains(
103+
"Class_WRONG"))
104+
Condition
105+
Error in `fit()`:
106+
! Can't select columns that don't exist.
107+
x Column `.pred` doesn't exist.
108+

tests/testthat/test-tailor.R

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,10 @@ test_that("error informatively with empty tidyselections", {
9393
)
9494

9595
# probability doesn't exist, is selection helper, isn't needed
96-
# (asserting here that we ought not to error on a bad selection
96+
# (asserting here that we ought to error on a bad selection
9797
# if it would not be used anyway.)
98-
# todo: need to overwrite column name for now, see #22.
99-
two_class_example$.pred <- two_class_example$Class2
100-
expect_no_condition(
98+
expect_snapshot(
99+
error = TRUE,
101100
tailor_fit <- tailor() %>%
102101
adjust_numeric_range(.5) %>%
103102
fit(

0 commit comments

Comments
 (0)