From 1dd58f57dac9548e3a8afb4b6555641c078bf7d9 Mon Sep 17 00:00:00 2001 From: Joshua Lambert Date: Fri, 13 Sep 2024 15:29:51 +0100 Subject: [PATCH] update tests that regression test the epiparameter database --- tests/testthat/_snaps/parameter_tbl.md | 4 ++-- tests/testthat/_snaps/print.md | 10 +++++----- tests/testthat/test-epiparameter.R | 2 +- tests/testthat/test-epiparameter_db.R | 4 ++-- tests/testthat/test-parameter_tbl.R | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/testthat/_snaps/parameter_tbl.md b/tests/testthat/_snaps/parameter_tbl.md index 1b53617e9..8bc8552bd 100644 --- a/tests/testthat/_snaps/parameter_tbl.md +++ b/tests/testthat/_snaps/parameter_tbl.md @@ -4,7 +4,7 @@ dist_tbl Output # Parameter table: - # A data frame: 122 x 7 + # A data frame: 125 x 7 disease pathogen epi_distribution prob_distribution author year sample_size 1 Adenovi~ Adenovi~ incubation peri~ lnorm Lessl~ 2009 14 @@ -17,7 +17,7 @@ 8 Parainf~ Parainf~ incubation peri~ lnorm Lessl~ 2009 11 9 RSV RSV incubation peri~ lnorm Lessl~ 2009 24 10 Rhinovi~ Rhinovi~ incubation peri~ lnorm Lessl~ 2009 28 - # i 112 more rows + # i 115 more rows # parameter_tbl works for incubation period with db diff --git a/tests/testthat/_snaps/print.md b/tests/testthat/_snaps/print.md index bcf48f683..e1f8c93bb 100644 --- a/tests/testthat/_snaps/print.md +++ b/tests/testthat/_snaps/print.md @@ -3,15 +3,15 @@ Code epiparameter_db() Message - Returning 122 results that match the criteria (99 are parameterised). + Returning 125 results that match the criteria (100 are parameterised). Use subset to filter by entry variables or single_epiparameter to return a single entry. To retrieve the citation for each use the 'get_citation' function Output - # List of 122 objects + # List of 125 objects Number of diseases: 23 > Adenovirus > COVID-19 > Chikungunya > Dengue > Ebola Virus Disease > Hantavirus Pulmonary Syndrome > Human Coronavirus > Influenza > Japanese Encephalitis > MERS > Marburg Virus Disease > Measles > Mpox > Parainfluenza > Pneumonic Plague > RSV > Rhinovirus > Rift Valley Fever > SARS > Smallpox > West Nile Fever > Yellow Fever > Zika Virus Disease - Number of epi distributions: 12 - > generation time > hospitalisation to death > hospitalisation to discharge > incubation period > notification to death > notification to discharge > offspring distribution > onset to death > onset to discharge > onset to hospitalisation > onset to ventilation > serial interval + Number of epi distributions: 13 + > case fatality risk > generation time > hospitalisation to death > hospitalisation to discharge > incubation period > notification to death > notification to discharge > offspring distribution > onset to death > onset to discharge > onset to hospitalisation > onset to ventilation > serial interval [[1]] Disease: Adenovirus Pathogen: Adenovirus @@ -54,7 +54,7 @@ meanlog: 0.660 sdlog: 1.205 - # i 119 more elements + # i 122 more elements # i Use `print(n = ...)` to see more elements. # i Use `parameter_tbl()` to see a summary table of the parameters. # i Explore database online at: https://epiverse-trace.github.io/epiparameter/articles/database.html diff --git a/tests/testthat/test-epiparameter.R b/tests/testthat/test-epiparameter.R index aea7fa13f..ac5d91aff 100644 --- a/tests/testthat/test-epiparameter.R +++ b/tests/testthat/test-epiparameter.R @@ -1263,7 +1263,7 @@ test_that("c.epiparameter works with & ", { test_that("c.multi_epiparameter works with two s", { res <- c(db, db) expect_s3_class(res, class = "multi_epiparameter") - expect_length(res, 244) + expect_length(res, 250) expect_s3_class(res[[1]], class = "epiparameter") }) diff --git a/tests/testthat/test-epiparameter_db.R b/tests/testthat/test-epiparameter_db.R index eedd415df..3ac8be9c6 100644 --- a/tests/testthat/test-epiparameter_db.R +++ b/tests/testthat/test-epiparameter_db.R @@ -208,7 +208,7 @@ test_that(".read_epiparameter_db works as expected", { db <- .read_epiparameter_db() expect_s3_class(db, class = "multi_epiparameter") expect_type(db, type = "list") - expect_length(db, 122) + expect_length(db, 125) expect_true(all(vapply(db, is_epiparameter, FUN.VALUE = logical(1)))) }) @@ -244,7 +244,7 @@ test_that("as.data.frame works for ", { db <- suppressMessages(epiparameter_db()) df <- as.data.frame(db) expect_s3_class(df, class = "data.frame") - expect_identical(dim(df), c(122L, 10L)) + expect_identical(dim(df), c(125L, 10L)) expect_identical( colnames(df), c("disease", "pathogen", "epi_distribution", "prob_distribution", diff --git a/tests/testthat/test-parameter_tbl.R b/tests/testthat/test-parameter_tbl.R index a4746bdbc..e6f2efd1e 100644 --- a/tests/testthat/test-parameter_tbl.R +++ b/tests/testthat/test-parameter_tbl.R @@ -4,7 +4,7 @@ db <- suppressMessages(epiparameter_db()) test_that("parameter_tbl works as expected supplied with db", { dist_tbl <- parameter_tbl(multi_epiparameter = db) expect_s3_class(dist_tbl, "data.frame") - expect_identical(dim(dist_tbl), c(122L, 7L)) + expect_identical(dim(dist_tbl), c(125L, 7L)) expect_named( dist_tbl, c("disease", "pathogen", "epi_distribution", "prob_distribution",