Skip to content

Commit

Permalink
added unit test for as_epidist from issue #327
Browse files Browse the repository at this point in the history
  • Loading branch information
joshwlambert committed Jun 14, 2024
1 parent 665c5a1 commit 25ab487
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/testthat/test-coercion.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
test_that("as_epidist works for infectious period (issue #327)", {
# {epireview} is not a dependency so only run if already on system
skip_if_not_installed("epireview")
# suppress warning and message about loading data
ebola <- suppressWarnings(
suppressMessages(
epireview::load_epidata("ebola")
)
)
ebola_params <- ebola$params
ebola_infectiousness <- ebola_params[
ebola_params$parameter_type == "Human delay - infectious period",
]
ebola_infectiousness <- ebola_infectiousness[
ebola_infectiousness$article_label == "Lau 2017 (1)",
]
# suppress warning and message about citation
ebola_infectiousness_epidist <- suppressWarnings(
suppressMessages(
as_epidist(ebola_infectiousness)
)
)
expect_s3_class(ebola_infectiousness_epidist, class = "epidist")
# Lau 2017 has information to parameterise an exponential distribution
expect_s3_class(
ebola_infectiousness_epidist$prob_dist,
class = "distribution"
)
# populate mean summary statistics
expect_true(all(!is.na(ebola_infectiousness_epidist$summary_stats[1:3])))
})

0 comments on commit 25ab487

Please sign in to comment.