Skip to content

Commit

Permalink
align r/test files for workflow happiness
Browse files Browse the repository at this point in the history
  • Loading branch information
simonpcouch committed Apr 22, 2024
1 parent 6e811da commit 17e154a
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 44 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 0 additions & 10 deletions tests/testthat/_snaps/validation-regression.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
# validation of classification operations
# validation of operations (regression)

Code
container(mode = "regression") %>% adjust_numeric_range(lower_limit = 2) %>%
adjust_numeric_calibration(dummy_reg_cal) %>% adjust_predictions_custom(
squared = .pred^2)
Condition
Error in `adjust_numeric_calibration()`:
! Calibration should come before other operations.

# validation of operations (classification)

Code
container(mode = "classification") %>% adjust_probability_threshold(threshold = 0.4) %>%
Expand Down
32 changes: 0 additions & 32 deletions tests/testthat/test-validation-regression.R

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
test_that("validation of classification operations", {
test_that("validation of operations (regression)", {
dummy_reg_cal <- list()
class(dummy_reg_cal) <- "cal_regression"

expect_silent(
reg_ctr <-
container(mode = "regression") %>%
adjust_numeric_calibration(dummy_reg_cal) %>%
adjust_numeric_range(lower_limit = 2) %>%
adjust_predictions_custom(squared = .pred^2)
)

expect_snapshot(
container(mode = "regression") %>%
adjust_numeric_range(lower_limit = 2) %>%
adjust_numeric_calibration(dummy_reg_cal) %>%
adjust_predictions_custom(squared = .pred^2),
error = TRUE
)

# todo should we error if a mutate occurs beforehand? Can we detect if it
# modifies the prediction?
expect_silent(
reg_ctr <-
container(mode = "regression") %>%
adjust_predictions_custom(squared = .pred^2) %>%
adjust_numeric_calibration(dummy_reg_cal) %>%
adjust_numeric_range(lower_limit = 2)
)
})

test_that("validation of operations (classification)", {
dummy_cls_cal <- list()
class(dummy_cls_cal) <- "cal_binary"

Expand Down

0 comments on commit 17e154a

Please sign in to comment.