tests/testthat/test_survival_reg.R

test_that("primary argument", {

  normal <- survival_reg(dist = "lnorm")

  expect_snapshot(normal)

  expect_equal(
    normal$args,
    list(dist = rlang::quo("lnorm"))
  )

  dist_v <- survival_reg(dist = tune())

  expect_snapshot(dist_v)

  expect_equal(
    dist_v$args,
    list(dist = rlang::quo(tune()))
  )
})

test_that("updating", {
  expect_snapshot(
    survival_reg() %>%
      update(dist = "lnorm")
  )
})

test_that("bad input", {
  expect_error(survival_reg(mode = ", classification"))
})

Try the parsnip package in your browser

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

parsnip documentation built on Aug. 18, 2023, 1:07 a.m.