tests/testthat/test-plot.R

test_that("plot.multi_epiparameter works for parameterised <epiparameter>", {
  # plotting changes global state of graphics pars so they are restored
  op <- par(no.readonly = TRUE)
  ep <- epiparameter_db(disease = "Ebola", epi_name = "serial")
  expect_silent(plot(ep))
  f <- function() plot(ep)
  vdiffr::expect_doppelganger(
    title = "plot.multi_epiparameter",
    fig = f
  )
  # restore graphics pars
  par(op)
})

test_that("plot.multi_epiparameter removes unparameterised or discrete dists", {
  # plotting changes global state of graphics pars so they are restored
  op <- par(no.readonly = TRUE)
  ep <- epiparameter_db(disease = "SARS")
  expect_warning(
    plot(ep),
    regexp = "(epiparameter)*(discrete or unparameterised)*(cannot be plotted)"
  )
  # restore graphics pars
  par(op)
})

Try the epiparameter package in your browser

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

epiparameter documentation built on April 3, 2025, 5:50 p.m.