Skip to content

Commit

Permalink
accept tidyselect error snap
Browse files Browse the repository at this point in the history
  • Loading branch information
simonpcouch committed Sep 16, 2024
1 parent f053382 commit 05c00b6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
11 changes: 11 additions & 0 deletions tests/testthat/_snaps/tailor.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,14 @@
! `probabilities` must select at least one column.
x Selector `tidyselect::contains("Class_WRONG")` did not match any columns in `.data`.

---

Code
tailor_fit <- tailor() %>% adjust_numeric_range(0.5) %>% fit(two_class_example,
outcome = "Class1", estimate = ".pred", probabilities = tidyselect::contains(
"Class_WRONG"))
Condition
Error in `fit()`:
! Can't select columns that don't exist.
x Column `.pred` doesn't exist.

7 changes: 3 additions & 4 deletions tests/testthat/test-tailor.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,10 @@ test_that("error informatively with empty tidyselections", {
)

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

0 comments on commit 05c00b6

Please sign in to comment.