tests/testthat/test-update.R

test_that("can update a step", {
  stp_4 <- recipes::step("stp", x = 4, trained = FALSE)
  stp_5 <- recipes::step("stp", x = 5, trained = FALSE)

  update(stp_4, x = 5)

  expect_equal(update(stp_4, x = 5), stp_5)
})

test_that("cannot create new fields for a step", {
  stp <- recipes::step("stp", x = 4, trained = FALSE)

  expect_snapshot(error = TRUE,
    update(stp, y = 5)
  )
})

test_that("cannot update trained steps", {
  stp <- recipes::step("stp", x = 4, trained = TRUE)

  expect_snapshot(error = TRUE,
    update(stp, x = 5)
  )
})

Try the recipes package in your browser

Any scripts or data that you put into this service are public.

recipes documentation built on Aug. 26, 2023, 1:08 a.m.