Skip to content

Commit

Permalink
reduce tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Orwa committed Oct 22, 2024
1 parent 58e4598 commit 98c881d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 142 deletions.
25 changes: 0 additions & 25 deletions tests/testthat/_snaps/est.incidence.by.md

This file was deleted.

30 changes: 0 additions & 30 deletions tests/testthat/_snaps/est.incidence.by.new.md

This file was deleted.

87 changes: 0 additions & 87 deletions tests/testthat/test-est.incidence.by.R
Original file line number Diff line number Diff line change
@@ -1,90 +1,3 @@
test_that(
"est.incidence.by() produces expected results for typhoid data",
{
library(dplyr)
# get pop data
xs_data <- load_pop_data(
file_path = "https://osf.io/download//n6cp3/",
age = "Age",
value = "result",
id = "index_id",
standardize = TRUE
) %>%
filter(Country == "Pakistan") %>%
slice_head(n = 100)

# get noise data
noise <- load_noise_params("https://osf.io/download//hqy4v/") %>%
filter(Country == "Pakistan")

# get curve data
curve <- load_curve_params("https://osf.io/download/rtw5k/") # slice if test is too slow (.by = antigen_iso))

# set start
start <- .05

typhoid_results <- est.incidence.by(
strata = c("catchment"),
pop_data = xs_data,
curve_param = curve,
curve_strata_varnames = "catchment",
noise_strata_varnames = "catchment",
noise_param = noise,
antigen_isos = c("HlyE_IgG", "HlyE_IgA"),
num_cores = 8 # Allow for parallel processing to decrease run time
)

expect_snapshot(x = typhoid_results)

expect_snapshot_value(typhoid_results, style = "deparse")
}
)

test_that("`est.incidence.by()` produces expected results", {
curves <- load_curve_params("https://osf.io/download/rtw5k/")
noise <- load_noise_params("https://osf.io/download//hqy4v/")
xs_data_true <- load_pop_data(
file_path = "https://osf.io/download//n6cp3/",
age = "Age",
value = "result",
id = "index_id",
standardize = TRUE
) %>%
filter(Country == "Pakistan") %>%
slice_head(n = 100)


est_true <- est.incidence.by(
strata = c("catchment"),
pop_data = xs_data_true,
curve_params = curves,
noise_params = noise %>% filter(Country == "Pakistan"),
antigen_isos = c("HlyE_IgG", "HlyE_IgA"),
num_cores = 8 # Allow for parallel processing to decrease run time
)

xs_data_false <- load_pop_data(
file_path = "https://osf.io/download//n6cp3/",
age = "Age",
value = "result",
id = "index_id",
standardize = FALSE
) %>%
filter(Country == "Pakistan") %>%
slice_head(n = 100)


est_false <- est.incidence.by(
strata = c("catchment"),
pop_data = xs_data_false,
curve_params = curves,
noise_params = noise %>% filter(Country == "Pakistan"),
antigen_isos = c("HlyE_IgG", "HlyE_IgA"),
num_cores = 8 # Allow for parallel processing to decrease run time
)

expect_equal(est_true, est_false)
})

test_that("est.incidence.by() issues warning when strata is missing", {

Expand Down

0 comments on commit 98c881d

Please sign in to comment.