Skip to content

Commit

Permalink
relax check for prediction names
Browse files Browse the repository at this point in the history
the name existence is the only thing in workflowsets "jurisdiction"---tune or downstream should be able to change order without breaking this package
  • Loading branch information
simonpcouch committed Feb 21, 2024
1 parent 9397788 commit 8013f0a
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions tests/testthat/test-collect-predictions.R
Original file line number Diff line number Diff line change
Expand Up @@ -129,22 +129,26 @@ test_that("collect predictions", {
skip_if(packageVersion("tune") <= "1.1.0")

test_that("dropping tuning parameter columns", {
expect_equal(
names(collect_predictions(car_set_1)),
c("wflow_id", ".config", "preproc", "model", ".row", "mpg", ".pred")
expect_named(
collect_predictions(car_set_1),
c("wflow_id", ".config", "preproc", "model", ".row", "mpg", ".pred"),
ignore.order = TRUE
)
expect_equal(
names(collect_predictions(car_set_2)),
c("wflow_id", ".config", "preproc", "model", ".row", "mpg", ".pred")
expect_named(
collect_predictions(car_set_2),
c("wflow_id", ".config", "preproc", "model", ".row", "mpg", ".pred"),
ignore.order = TRUE
)

expect_equal(
names(collect_predictions(car_set_1, summarize = FALSE)),
c("wflow_id", ".config", "preproc", "model", "id", ".pred", ".row", "mpg")
expect_named(
collect_predictions(car_set_1, summarize = FALSE),
c("wflow_id", ".config", "preproc", "model", "id", ".pred", ".row", "mpg"),
ignore.order = TRUE
)
expect_equal(
names(collect_predictions(car_set_2, summarize = FALSE)),
c("wflow_id", ".config", "preproc", "model", "id", "id2", ".pred", ".row", "mpg")
expect_named(
collect_predictions(car_set_2, summarize = FALSE),
c("wflow_id", ".config", "preproc", "model", "id", "id2", ".pred", ".row", "mpg"),
ignore.order = TRUE
)

expect_error(
Expand All @@ -159,7 +163,11 @@ test_that("dropping tuning parameter columns", {
workflowsets:::select_bare_predictions(car_set_3$result[[1]], metric = "rmse", TRUE),
regex = NA
)
expect_equal(names(no_param), c(".row", "mpg", ".config", ".iter", ".pred"))
expect_named(
no_param,
c(".row", "mpg", ".config", ".iter", ".pred"),
ignore.order = TRUE
)
})


Expand Down

0 comments on commit 8013f0a

Please sign in to comment.