tests/testthat/test_nearest_neighbor.R

test_that('updating', {
  expect_snapshot(
    nearest_neighbor(neighbors = 5) %>%
      set_engine("kknn", scale = FALSE) %>%
      update(neighbors = tune(), scale = tune())
  )
})

test_that('bad input', {
  expect_error(nearest_neighbor(mode = "reallyunknown"))
  expect_error(nearest_neighbor() %>% set_engine( NULL))
})

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.