tests/testthat/test_generic.R

context("Test generics")

empty_explainer <- local_model_explainer_ap
empty_explainer$estimated <- 0

testthat::test_that("Plots work with different geoms", {
  testthat::expect_silent({
    plot(local_model_explainer_ap)
    plot(local_model_explainer_ap, geom = "bar")
    plot(local_model_explainer_ap, geom = "arrow")
  })
  testthat::expect_message({
    plot(empty_explainer)
    })
})

testthat::test_that("Print is okay", {
  testthat::expect_output({
    print(local_model_explainer_ap)
  })
})

testthat::test_that("Kernels work fine", {
  testthat::expect_true({
    identity_kernel(HR[2, ], HR[1, ]) == 1
  })
  testthat::expect_false({
    gaussian_kernel(HR[2, 2:5], HR[1, 2:5]) == 1
  })
})

Try the localModel package in your browser

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

localModel documentation built on Sept. 14, 2021, 5:12 p.m.