tests/testthat/test-locate.R

test_that("locate works", {
  lm_fit <- lm(mpg ~ ., data = mtcars)
  expect_equal(locate(lm_fit, "env"), "x$terms")
  expect_equal(locate(lm_fit, "call"), "x$call")
  expect_equal(locate(lm_fit, "fitted"), c("x$fitted.values", "x$residuals"))
  expect_error(locate(lm_fit, "whatever"))
})
tidymodels/butcher documentation built on April 15, 2024, 9:18 p.m.