From 459e5884ffa61d3dea67dcbb11d40cee1f387add Mon Sep 17 00:00:00 2001 From: Emil Hvitfeldt Date: Fri, 25 Oct 2024 15:13:41 -0700 Subject: [PATCH 1/8] mark unreachable --- R/aaa-metrics.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/R/aaa-metrics.R b/R/aaa-metrics.R index eb6345fd..a3289336 100644 --- a/R/aaa-metrics.R +++ b/R/aaa-metrics.R @@ -270,6 +270,7 @@ metric_set <- function(...) { )) { make_survival_metric_function(fns) } else { + # should not be reachable cli::cli_abort( "{.fn validate_function_class} should have errored on unknown classes.", .internal = TRUE @@ -345,6 +346,7 @@ get_quo_label <- function(quo) { out <- as_label(quo) if (length(out) != 1L) { + # should not be reachable cli::cli_abort( "{.code as_label(quo)} resulted in a character vector of length >1.", .internal = TRUE From 38ff1e9bded4eabe0dd2b670d49c71c9b249bf7e Mon Sep 17 00:00:00 2001 From: Emil Hvitfeldt Date: Fri, 25 Oct 2024 15:59:56 -0700 Subject: [PATCH 2/8] mark unreachable --- R/class-mcc.R | 1 + R/prob-helpers.R | 1 + R/prob-roc_auc.R | 1 + R/template.R | 4 +++- 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/R/class-mcc.R b/R/class-mcc.R index a3461f52..c9a85b75 100644 --- a/R/class-mcc.R +++ b/R/class-mcc.R @@ -161,6 +161,7 @@ mcc_multiclass_impl <- function(C) { check_mcc_data <- function(data) { if (!is.double(data) && !is.matrix(data)) { + # should not be reachable cli::cli_abort( "{.arg data} should be a double matrix at this point.", .internal = TRUE diff --git a/R/prob-helpers.R b/R/prob-helpers.R index d118866e..58f815d2 100644 --- a/R/prob-helpers.R +++ b/R/prob-helpers.R @@ -11,6 +11,7 @@ auc <- function(x, y, na_rm = TRUE) { } if (is.unsorted(x, na.rm = TRUE, strictly = FALSE)) { + # should not be reachable cli::cli_abort( "{.arg x} must already be in weakly increasing order.", .internal = TRUE diff --git a/R/prob-roc_auc.R b/R/prob-roc_auc.R index 09e080b7..475f0094 100644 --- a/R/prob-roc_auc.R +++ b/R/prob-roc_auc.R @@ -163,6 +163,7 @@ roc_auc_estimator_impl <- function(truth, roc_auc_binary(truth, estimate, event_level, case_weights) } else if (estimator == "hand_till") { if (!is.null(case_weights)) { + # should be unreachable cli::cli_abort( "{.arg case_weights} should be `NULL` at this point for hand-till.", .internal = TRUE diff --git a/R/template.R b/R/template.R index 9ec00771..721ac12e 100644 --- a/R/template.R +++ b/R/template.R @@ -721,6 +721,7 @@ prob_estimate_convert <- function(estimate) { n_estimate <- ncol(estimate) if (n_estimate == 0L) { + # should be unreachable cli::cli_abort( "{.arg estimate} should have errored during tidy-selection.", .internal = TRUE @@ -780,7 +781,8 @@ yardstick_eval_select <- function(expr, if (length(out) != 1L) { cli::cli_abort( - "{.arg arg} must select exactly 1 column from `data`, not {length(out)}.", + "{.arg {arg}} must select exactly 1 column from {.arg data}, + not {length(out)}.", call = error_call ) } From 5e5a3bc09a00d2feaa0d5cfeee2ad97e2cf90b9c Mon Sep 17 00:00:00 2001 From: Emil Hvitfeldt Date: Fri, 25 Oct 2024 16:00:04 -0700 Subject: [PATCH 3/8] snapshot more errors --- R/aaa-metrics.R | 4 +++- tests/testthat/_snaps/aaa-metrics.md | 8 ++++++++ tests/testthat/_snaps/conf_mat.md | 8 ++++++++ tests/testthat/_snaps/estimator-helpers.md | 8 ++++++++ tests/testthat/_snaps/event-level.md | 8 ++++++++ tests/testthat/_snaps/num-mase.md | 8 ++++++++ tests/testthat/_snaps/prob-gain_curve.md | 9 +++++++++ tests/testthat/_snaps/prob-pr_curve.md | 9 +++++++++ tests/testthat/_snaps/template.md | 16 ++++++++++++++++ tests/testthat/_snaps/validation.md | 8 ++++++++ tests/testthat/test-aaa-metrics.R | 7 +++++++ tests/testthat/test-conf_mat.R | 7 +++++++ tests/testthat/test-estimator-helpers.R | 6 ++++++ tests/testthat/test-event-level.R | 8 ++++++++ tests/testthat/test-num-mase.R | 14 +++++++++++--- tests/testthat/test-prob-gain_curve.R | 12 ++++++++++++ tests/testthat/test-prob-pr_curve.R | 12 ++++++++++++ tests/testthat/test-template.R | 11 +++++++++++ tests/testthat/test-validation.R | 8 ++++++++ 19 files changed, 167 insertions(+), 4 deletions(-) create mode 100644 tests/testthat/_snaps/estimator-helpers.md create mode 100644 tests/testthat/test-estimator-helpers.R diff --git a/R/aaa-metrics.R b/R/aaa-metrics.R index a3289336..b8ac8aa5 100644 --- a/R/aaa-metrics.R +++ b/R/aaa-metrics.R @@ -575,7 +575,9 @@ make_survival_metric_function <- function(fns) { validate_not_empty <- function(x, call = caller_env()) { if (is_empty(x)) { - cli::cli_abort("At least 1 function supplied to `...`.", call = call) + cli::cli_abort( + "At least 1 function must be supplied to {.code ...}.", call = call + ) } } diff --git a/tests/testthat/_snaps/aaa-metrics.md b/tests/testthat/_snaps/aaa-metrics.md index db5b793d..c1fc39d1 100644 --- a/tests/testthat/_snaps/aaa-metrics.md +++ b/tests/testthat/_snaps/aaa-metrics.md @@ -155,3 +155,11 @@ ! Can't select columns that don't exist. x Column `weight` doesn't exist. +# metric_set() errors on empty input + + Code + metric_set() + Condition + Error in `metric_set()`: + ! At least 1 function must be supplied to `...`. + diff --git a/tests/testthat/_snaps/conf_mat.md b/tests/testthat/_snaps/conf_mat.md index c930ce59..0f145f69 100644 --- a/tests/testthat/_snaps/conf_mat.md +++ b/tests/testthat/_snaps/conf_mat.md @@ -128,3 +128,11 @@ ! Can't select columns that don't exist. x Column `not_predicted` doesn't exist. +# conf_mat() error on 1-level factor truth + + Code + conf_mat(table(1, 1)) + Condition + Error in `conf_mat()`: + ! There must be at least 2 factors levels in the `data`. + diff --git a/tests/testthat/_snaps/estimator-helpers.md b/tests/testthat/_snaps/estimator-helpers.md new file mode 100644 index 00000000..5e7658a9 --- /dev/null +++ b/tests/testthat/_snaps/estimator-helpers.md @@ -0,0 +1,8 @@ +# get_weights() errors with wrong estimator + + Code + get_weights(mtcars, "wrong") + Condition + Error in `get_weights()`: + ! `estimator` type "wrong" is unknown. + diff --git a/tests/testthat/_snaps/event-level.md b/tests/testthat/_snaps/event-level.md index 2983df31..101f6cb9 100644 --- a/tests/testthat/_snaps/event-level.md +++ b/tests/testthat/_snaps/event-level.md @@ -18,3 +18,11 @@ i Please use the metric function argument `event_level` instead. i The global option is being ignored entirely. +# validate_event_level() works + + Code + recall(two_class_example, truth, predicted, event_level = "wrong") + Condition + Error in `recall()`: + ! `event_level` must be "first" or "second". + diff --git a/tests/testthat/_snaps/num-mase.md b/tests/testthat/_snaps/num-mase.md index 470e39f2..6fd188fd 100644 --- a/tests/testthat/_snaps/num-mase.md +++ b/tests/testthat/_snaps/num-mase.md @@ -38,3 +38,11 @@ Error in `mase_vec()`: ! `mae_train` must be a number or `NULL`, not the string "x". +# mase() errors if m is larger than number of observations + + Code + mase(mtcars, mpg, disp, m = 100) + Condition + Error in `mase()`: + ! `truth` (32) must have a length greater than `m` (100) to compute the out-of-sample naive mean absolute error. + diff --git a/tests/testthat/_snaps/prob-gain_curve.md b/tests/testthat/_snaps/prob-gain_curve.md index f0712792..6ca4c379 100644 --- a/tests/testthat/_snaps/prob-gain_curve.md +++ b/tests/testthat/_snaps/prob-gain_curve.md @@ -6,6 +6,15 @@ Error in `gain_curve()`: ! `truth` should be a factor, not a a number. +# na_rm = FALSE errors if missing values are present + + Code + gain_curve_vec(df$truth, df$Class1, na_rm = FALSE) + Condition + Error in `gain_curve_vec()`: + x Missing values were detected and `na_ra = FALSE`. + i Not able to perform calculations. + # errors with class_pred input Code diff --git a/tests/testthat/_snaps/prob-pr_curve.md b/tests/testthat/_snaps/prob-pr_curve.md index 690f9756..0451e8ac 100644 --- a/tests/testthat/_snaps/prob-pr_curve.md +++ b/tests/testthat/_snaps/prob-pr_curve.md @@ -14,3 +14,12 @@ Error in `pr_curve_vec()`: ! `truth` should not a object. +# na_rm = FALSE errors if missing values are present + + Code + pr_curve_vec(df$truth, df$Class1, na_rm = FALSE) + Condition + Error in `pr_curve_vec()`: + x Missing values were detected and `na_ra = FALSE`. + i Not able to perform calculations. + diff --git a/tests/testthat/_snaps/template.md b/tests/testthat/_snaps/template.md index 2be11ae1..b4bb31dc 100644 --- a/tests/testthat/_snaps/template.md +++ b/tests/testthat/_snaps/template.md @@ -1,3 +1,19 @@ +# errors are thrown truth or estimate selects more than 1 column + + Code + rmse(mtcars, mpg, tidyselect::starts_with("d")) + Condition + Error in `rmse()`: + ! `estimate` must select exactly 1 column from `data`, not 2. + +--- + + Code + rmse(mtcars, tidyselect::starts_with("d"), mpg) + Condition + Error in `rmse()`: + ! `truth` must select exactly 1 column from `data`, not 2. + # numeric_metric_summarizer()'s errors when wrong things are passes Code diff --git a/tests/testthat/_snaps/validation.md b/tests/testthat/_snaps/validation.md index 9e4da904..318f8e9c 100644 --- a/tests/testthat/_snaps/validation.md +++ b/tests/testthat/_snaps/validation.md @@ -249,6 +249,14 @@ Error: ! `estimate` should be a list, not a a double vector. +--- + + Code + validate_surv_truth_list_estimate(lung_surv$surv_obj[1:5, ], lung_surv$.pred) + Condition + Error: + ! `truth` (5) and `estimate` (228) must be the same length. + --- Code diff --git a/tests/testthat/test-aaa-metrics.R b/tests/testthat/test-aaa-metrics.R index bc461124..078cf356 100644 --- a/tests/testthat/test-aaa-metrics.R +++ b/tests/testthat/test-aaa-metrics.R @@ -521,3 +521,10 @@ test_that("metric_tweak and metric_set plays nicely together (#351)", { ref ) }) + +test_that("metric_set() errors on empty input", { + expect_snapshot( + error = TRUE, + metric_set() + ) +}) diff --git a/tests/testthat/test-conf_mat.R b/tests/testthat/test-conf_mat.R index 2fa3efe2..e6cabeb0 100644 --- a/tests/testthat/test-conf_mat.R +++ b/tests/testthat/test-conf_mat.R @@ -290,3 +290,10 @@ test_that("conf_mat()'s errors when wrong things are passes", { ) ) }) + +test_that("conf_mat() error on 1-level factor truth", { + expect_snapshot( + error = TRUE, + conf_mat(table(1, 1)) + ) +}) diff --git a/tests/testthat/test-estimator-helpers.R b/tests/testthat/test-estimator-helpers.R new file mode 100644 index 00000000..44c6ca66 --- /dev/null +++ b/tests/testthat/test-estimator-helpers.R @@ -0,0 +1,6 @@ +test_that("get_weights() errors with wrong estimator", { + expect_snapshot( + error = TRUE, + get_weights(mtcars, "wrong") + ) +}) diff --git a/tests/testthat/test-event-level.R b/tests/testthat/test-event-level.R index 327efc74..5a50dcad 100644 --- a/tests/testthat/test-event-level.R +++ b/tests/testthat/test-event-level.R @@ -17,3 +17,11 @@ test_that("`yardstick_event_level()` ignores option - FALSE, with a warning", { expect_snapshot(out <- yardstick_event_level()) expect_identical(out, "first") }) + +test_that("validate_event_level() works", { + expect_snapshot( + error = TRUE, + recall(two_class_example, truth, predicted, event_level = "wrong") + ) +}) + diff --git a/tests/testthat/test-num-mase.R b/tests/testthat/test-num-mase.R index 999a0983..e3faeeec 100644 --- a/tests/testthat/test-num-mase.R +++ b/tests/testthat/test-num-mase.R @@ -84,10 +84,18 @@ test_that("works with hardhat case weights", { freq_wgt <- hardhat::frequency_weights(df$weights) expect_no_error( - mape_vec(df$solubility, df$prediction, case_weights = imp_wgt) + mase_vec(df$solubility, df$prediction, case_weights = imp_wgt) ) expect_no_error( - mape_vec(df$solubility, df$prediction, case_weights = freq_wgt) + mase_vec(df$solubility, df$prediction, case_weights = freq_wgt) ) -}) \ No newline at end of file +}) + +test_that("mase() errors if m is larger than number of observations", { + expect_snapshot( + error = TRUE, + mase(mtcars, mpg, disp, m = 100) + ) +}) + diff --git a/tests/testthat/test-prob-gain_curve.R b/tests/testthat/test-prob-gain_curve.R index b3afd1ea..d00b1637 100644 --- a/tests/testthat/test-prob-gain_curve.R +++ b/tests/testthat/test-prob-gain_curve.R @@ -50,6 +50,18 @@ test_that("`event_level = 'second'` works", { ) }) +# na_rm ------------------------------------------------------------------------ + +test_that("na_rm = FALSE errors if missing values are present", { + df <- two_class_example + df$Class1[1] <- NA + + expect_snapshot( + error = TRUE, + gain_curve_vec(df$truth, df$Class1, na_rm = FALSE) + ) +}) + # Duplicates ------------------------------------------------------------------- test_that("duplicates are removed", { diff --git a/tests/testthat/test-prob-pr_curve.R b/tests/testthat/test-prob-pr_curve.R index f17ab35f..fd71d42b 100644 --- a/tests/testthat/test-prob-pr_curve.R +++ b/tests/testthat/test-prob-pr_curve.R @@ -256,3 +256,15 @@ test_that("Binary weighted results are the same as scikit-learn", { read_pydata("py-pr-curve")$case_weight$binary ) }) + +# na_rm ------------------------------------------------------------------------ + +test_that("na_rm = FALSE errors if missing values are present", { + df <- two_class_example + df$Class1[1] <- NA + + expect_snapshot( + error = TRUE, + pr_curve_vec(df$truth, df$Class1, na_rm = FALSE) + ) +}) diff --git a/tests/testthat/test-template.R b/tests/testthat/test-template.R index a3db85cc..fef06422 100644 --- a/tests/testthat/test-template.R +++ b/tests/testthat/test-template.R @@ -14,6 +14,17 @@ test_that("missing values in case weights are considered by `na_rm`", { ) }) +test_that("errors are thrown truth or estimate selects more than 1 column", { + expect_snapshot( + error = TRUE, + rmse(mtcars, mpg, tidyselect::starts_with("d")) + ) + expect_snapshot( + error = TRUE, + rmse(mtcars, tidyselect::starts_with("d"), mpg) + ) +}) + ## numeric_metric_summarizer -------------------------------------------------- test_that("numeric_metric_summarizer() works as expected", { diff --git a/tests/testthat/test-validation.R b/tests/testthat/test-validation.R index 4e41221a..964d7bac 100644 --- a/tests/testthat/test-validation.R +++ b/tests/testthat/test-validation.R @@ -388,6 +388,14 @@ test_that("validate_surv_truth_list_estimate errors as expected", { ) ) + expect_snapshot( + error = TRUE, + validate_surv_truth_list_estimate( + lung_surv$surv_obj[1:5, ], + lung_surv$.pred + ) + ) + lung_surv_not_all_same <- lung_surv lung_surv_not_all_same$.pred[[5]]$.eval_time[1] <- 350 lung_surv_not_all_same$.pred[[10]]$.eval_time[1] <- 350 From 78a0eb404cefcb7b5ebdda3eb6365d0c35774fa5 Mon Sep 17 00:00:00 2001 From: Emil Hvitfeldt Date: Fri, 25 Oct 2024 16:01:06 -0700 Subject: [PATCH 4/8] mark unreachable code in binary threshold --- R/prob-binary-thresholds.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/R/prob-binary-thresholds.R b/R/prob-binary-thresholds.R index c633be58..7c12a1c5 100644 --- a/R/prob-binary-thresholds.R +++ b/R/prob-binary-thresholds.R @@ -16,24 +16,28 @@ binary_threshold_curve <- function(truth, case_weights <- vec_cast(case_weights, to = double()) if (!is.factor(truth)) { + # should be unreachable cli::cli_abort( "{.arg truth} must be a factor, not {.obj_type_friendly {truth}}.", .internal = TRUE ) } if (length(levels(truth)) != 2L) { + # should be unreachable cli::cli_abort( "{.arg truth} must have two levels, not {length(levels(truth))}.", .internal = TRUE ) } if (!is.numeric(estimate)) { + # should be unreachable cli::cli_abort( "{.arg estimate} must be numeric vector, not {.obj_type_friendly {estimate}}.", .internal = TRUE ) } if (length(truth) != length(estimate)) { + # should be unreachable cli::cli_abort( "{.arg truth} ({length(truth)}) and {.arg estimate} ({length(estimate)}) must be the same length.", @@ -41,6 +45,7 @@ binary_threshold_curve <- function(truth, ) } if (length(truth) != length(case_weights)) { + # should be unreachable cli::cli_abort( "{.arg truth} ({length(truth)}) and {.arg case_weights} ({length(case_weights)}) must be the same length.", From 48a0d39d51838a7151befee2935dd6c18ca294c0 Mon Sep 17 00:00:00 2001 From: Emil Hvitfeldt Date: Fri, 25 Oct 2024 16:11:41 -0700 Subject: [PATCH 5/8] mark unreachable errors in misc.R --- R/misc.R | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/R/misc.R b/R/misc.R index 60fd5bdc..1838874d 100644 --- a/R/misc.R +++ b/R/misc.R @@ -195,6 +195,7 @@ yardstick_cov <- function(truth, size <- vec_size(truth) if (size != vec_size(estimate)) { + # should be unreachable cli::cli_abort( "{.arg truth} ({vec_size(truth)}) and {.arg estimate} ({vec_size(estimate)}) must be the same size.", @@ -202,6 +203,7 @@ yardstick_cov <- function(truth, ) } if (size != vec_size(case_weights)) { + # should be unreachable cli::cli_abort( "{.arg truth} ({vec_size(truth)}) and {.arg case_weights} ({vec_size(case_weights)}) must be the same size.", @@ -249,6 +251,7 @@ yardstick_cor <- function(truth, size <- vec_size(truth) if (size != vec_size(estimate)) { + # should be unreachable cli::cli_abort( "{.arg truth} ({vec_size(truth)}) and {.arg estimate} ({vec_size(estimate)}) must be the same size.", @@ -256,6 +259,7 @@ yardstick_cor <- function(truth, ) } if (size != vec_size(case_weights)) { + # should be unreachable cli::cli_abort( "{.arg truth} ({vec_size(truth)}) and {.arg case_weights} ({vec_size(case_weights)}) must be the same size.", @@ -488,6 +492,7 @@ yardstick_truth_table <- function(truth, ..., case_weights = NULL) { abort_if_class_pred(truth) if (!is.factor(truth)) { + # should be unreachable cli::cli_abort("{.arg truth} must be a factor.", .internal = TRUE) } @@ -495,6 +500,7 @@ yardstick_truth_table <- function(truth, ..., case_weights = NULL) { n_levels <- length(levels) if (n_levels < 2) { + # should be unreachable cli::cli_abort( "{.arg truth} must have at least 2 factor levels.", .internal = TRUE From b0f6cb3fc229ab0fd31cdb8d9924caa4be6ddac8 Mon Sep 17 00:00:00 2001 From: Emil Hvitfeldt Date: Fri, 25 Oct 2024 16:33:30 -0700 Subject: [PATCH 6/8] delete duplicate code --- R/misc.R | 8 -------- 1 file changed, 8 deletions(-) diff --git a/R/misc.R b/R/misc.R index 1838874d..0e52f646 100644 --- a/R/misc.R +++ b/R/misc.R @@ -3,10 +3,6 @@ # Column name extractors pos_val <- function(xtab, event_level) { - if (!all(dim(xtab) == 2)) { - cli::cli_abort("Only relevant for 2x2 tables.") - } - if (is_event_first(event_level)) { colnames(xtab)[[1]] } else { @@ -15,10 +11,6 @@ pos_val <- function(xtab, event_level) { } neg_val <- function(xtab, event_level) { - if (!all(dim(xtab) == 2)) { - cli::cli_abort("Only relevant for 2x2 tables.") - } - if (is_event_first(event_level)) { colnames(xtab)[[2]] } else { From 5a21ffc461d62a8e66963294ecc914c6f5d52412 Mon Sep 17 00:00:00 2001 From: Emil Hvitfeldt Date: Fri, 25 Oct 2024 16:33:56 -0700 Subject: [PATCH 7/8] last snapshot --- tests/testthat/_snaps/misc.md | 8 ++++++++ tests/testthat/test-misc.R | 25 +++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/tests/testthat/_snaps/misc.md b/tests/testthat/_snaps/misc.md index b1d4e720..6607d9d3 100644 --- a/tests/testthat/_snaps/misc.md +++ b/tests/testthat/_snaps/misc.md @@ -152,3 +152,11 @@ Error in `weighted_quantile()`: ! `probabilities` can't have missing values. +# work with class_pred input + + Code + accuracy_vec(fct_truth, cp_estimate) + Condition + Error in `as_factor_from_class_pred()`: + ! A input was detected, but the probably package isn't installed. Install probably to be able to convert to . + diff --git a/tests/testthat/test-misc.R b/tests/testthat/test-misc.R index 6d6a8bb5..bf8a21c1 100644 --- a/tests/testthat/test-misc.R +++ b/tests/testthat/test-misc.R @@ -350,3 +350,28 @@ test_that("`probabilities` must be in [0, 1]", { test_that("`probabilities` can't be missing", { expect_snapshot(error = TRUE, weighted_quantile(1, 1, NA)) }) + +test_that("work with class_pred input", { + skip_if_not_installed("probably") + + cp_truth <- probably::as_class_pred(two_class_example$truth, which = 1) + cp_estimate <- probably::as_class_pred(two_class_example$predicted, which = 2) + + fct_truth <- two_class_example$truth + fct_truth[1] <- NA + + fct_estimate <- two_class_example$predicted + fct_estimate[2] <- NA + + local_mocked_bindings( + .package = "rlang", + detect_installed = function(pkg, ...) { + FALSE + } + ) + + expect_snapshot( + error = TRUE, + accuracy_vec(fct_truth, cp_estimate) + ) +}) From e2580252f0f75e725a48e53af200213950afe414 Mon Sep 17 00:00:00 2001 From: Emil Hvitfeldt Date: Wed, 30 Oct 2024 12:33:16 -0700 Subject: [PATCH 8/8] Update tests/testthat/test-template.R Co-authored-by: Hannah Frick --- tests/testthat/test-template.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-template.R b/tests/testthat/test-template.R index fef06422..601e5f68 100644 --- a/tests/testthat/test-template.R +++ b/tests/testthat/test-template.R @@ -14,7 +14,7 @@ test_that("missing values in case weights are considered by `na_rm`", { ) }) -test_that("errors are thrown truth or estimate selects more than 1 column", { +test_that("errors are thrown if truth or estimate selects more than 1 column", { expect_snapshot( error = TRUE, rmse(mtcars, mpg, tidyselect::starts_with("d"))