tests/testthat/test-shrink.R

test_that("an outcome can also be a predictor and is only returned once", {
  x <- mold(Sepal.Length ~ Sepal.Length, iris)

  expect_equal(
    colnames(shrink(iris, x$blueprint$ptypes$predictors)),
    "Sepal.Length"
  )
})

test_that("`data` must be data-like", {
  ptype <- data.frame(x = integer())

  expect_snapshot(error = TRUE, {
    shrink(1, ptype)
  })
})
tidymodels/hardhat documentation built on Sept. 26, 2024, 11:38 p.m.