Skip to content

Commit

Permalink
update news and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
seabbs committed Dec 21, 2023
1 parent cf4772f commit 9e027f9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* The functions `get_dist`, `get_generation_time`, `get_incubation_period` have been deprecated and replaced with examples. By @sbfnk in #481 and reviewed by @seabbs.
* The utility function `update_list()` has been deprecated in favour of `utils::modifyList()` because it comes with an installation of R. By @jamesmbaazam in #491 and reviewed by @seabbs.
* The `fixed` argument to `dist_spec` has been deprecated and replaced by a `fix_dist()` function. By @sbfnk in #503 and reviewed by @seabbs.
* Updated `estimate_infections()` so that rather than imputing missing data, it now skips these data points in the likelihood. This is a breaking change as it changes the behaviour of the model when dates are missing from a time series but are known to be zero. We recommend that users check their results when updating to this version. By @seabbs in # and reviewed by @sbfnk.
* Updated `estimate_infections()` so that rather than imputing missing data, it now skips these data points in the likelihood. This is a breaking change as it alters the behaviour of the model when dates are missing from a time series but are known to be zero. We recommend that users check their results when updating to this version but expect this to in most cases improve performance. By @seabbs in # and reviewed by @sbfnk.

## Documentation

Expand Down
4 changes: 3 additions & 1 deletion tests/testthat/test-create_clean_reported_cases.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ test_that("create_clean_reported_cases filters leading zeros correctly", {

result <- create_clean_reported_cases(modified_data, 7)
# Check if the first row with non-zero cases is retained
expect_equal(result$date[1], min(modified_data$date[modified_data$confirm > 0]))
expect_equal(
result$date[1], min(modified_data$date[modified_data$confirm > 0])
)
})

test_that("create_clean_reported_cases replaces zero cases correctly", {
Expand Down
Empty file.
8 changes: 8 additions & 0 deletions tests/testthat/test-estimate_infections.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ test_that("estimate_infections successfully returns estimates using default sett
test_estimate_infections(reported_cases)
})

test_that("estimate_infections successfully returns estimates when passed NA values", {
skip_on_cran()
reported_cases_na <- data.table::copy(reported_cases)
reported_cases_na[sample(1:30, 5), confirm := NA]
test_estimate_infections(reported_cases_na)
})


test_that("estimate_infections successfully returns estimates using no delays", {
skip_on_cran()
test_estimate_infections(reported_cases, delay = FALSE)
Expand Down

0 comments on commit 9e027f9

Please sign in to comment.