Skip to content

Commit

Permalink
expect_warning() -> expect_snapshot()
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilHvitfeldt committed Sep 24, 2024
1 parent 7f29fa6 commit ec5e8f2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions tests/testthat/_snaps/discretize_cart.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@

# bake method errors when needed non-standard role columns are missing

Code
rec_trained <- prep(rec, training = sim_tr_cls, verbose = FALSE)
Condition
Warning:
`step_discretize_cart()` failed to find any meaningful splits for predictor 'z', which will not be binned.

---

Code
bake(rec_trained, new_data = sim_tr_cls[, -1])
Condition
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-discretize_cart.R
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ test_that("bake method errors when needed non-standard role columns are missing"
update_role(x, new_role = "potato") %>%
update_role_requirements(role = "potato", bake = FALSE)

expect_warning(
expect_snapshot(
rec_trained <- prep(rec, training = sim_tr_cls, verbose = FALSE)
)

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-woe.R
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ test_that("add_woe do not accept dictionary with unexpected layout", {
})

# test_that("add_woe warns user if the variable has too many levels", {
# expect_warning(credit_data %>% add_woe("Status", Expenses))
# expect_snapshot(credit_data %>% add_woe("Status", Expenses))
# })

# step_woe ----------------------------------------------------------------
Expand Down

0 comments on commit ec5e8f2

Please sign in to comment.