Skip to content

Commit

Permalink
Update ebola model tests and snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
pratikunterwegs committed Apr 15, 2024
1 parent fd1ddc3 commit fece4bc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
12 changes: 6 additions & 6 deletions tests/testthat/_snaps/model_ebola.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
5: 1 full_pop funeral 0 1
6: 1 full_pop removed 0 1
7: 2 full_pop susceptible 66989 1
8: 2 full_pop exposed 9 1
9: 2 full_pop infectious 2 1
8: 2 full_pop exposed 10 1
9: 2 full_pop infectious 1 1
10: 2 full_pop hospitalised 0 1
11: 2 full_pop funeral 0 1
12: 2 full_pop removed 0 1
13: 3 full_pop susceptible 66989 1
14: 3 full_pop exposed 6 1
15: 3 full_pop infectious 5 1
14: 3 full_pop exposed 9 1
15: 3 full_pop infectious 2 1
16: 3 full_pop hospitalised 0 1
17: 3 full_pop funeral 0 1
18: 3 full_pop removed 0 1
19: 4 full_pop susceptible 66988 1
20: 4 full_pop exposed 6 1
19: 4 full_pop susceptible 66989 1
20: 4 full_pop exposed 8 1
time demography_group compartment value replicate

16 changes: 4 additions & 12 deletions tests/testthat/test-model_ebola.R
Original file line number Diff line number Diff line change
Expand Up @@ -643,11 +643,6 @@ test_that("Ebola model: seed management", {
transmission_rate = intervention(
"transmission", "rate", 50, 100, 1.0
)
),
scenario_02 = list(
transmission_rate = intervention(
"transmission", "rate", 50, 100, 1.0
)
)
)
output <- model_ebola(
Expand All @@ -662,13 +657,11 @@ test_that("Ebola model: seed management", {
data_early <- lapply(data, function(df) {
split(df[time == 10L], by = "replicate")
})

# TODO: fix this test
expect_true(
Reduce(identical, data_early)
)

# expect that early outcomes varying within scenarios
# expect that early outcomes vary _within_ scenarios
expect_false(
all(
vapply(data_early, FUN = function(l) {
Expand All @@ -682,12 +675,11 @@ test_that("Ebola model: seed management", {
)
)

# expect that late outcomes are identical _across_ parameter sets
# expect that late outcomes are different _across_ sets
data_late <- lapply(data, function(df) {
split(df[time > max(time) - 5L], by = "replicate")
split(df[time == max(time)], by = "replicate")
})

expect_false(
Reduce(identical, data_early)
Reduce(identical, data_late)
)
})

0 comments on commit fece4bc

Please sign in to comment.