-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First draft on moving marginal_model into functions
- Loading branch information
Showing
2 changed files
with
104 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,45 @@ | ||
test_that("as_epidist_marginal_model.epidist_linelist_data with default settings an object with the correct classes", { # nolint: line_length_linter. | ||
prep_obs <- as_epidist_marginal_model(sim_obs) | ||
expect_s3_class(prep_obs, "data.frame") | ||
expect_s3_class(prep_obs, "epidist_latent_model") | ||
expect_s3_class(prep_obs, "epidist_marginal_model") | ||
}) | ||
|
||
test_that("as_epidist_marginal_model.epidist_linelist_data when passed incorrect inputs", { # nolint: line_length_linter. | ||
expect_error(as_epidist_marginal_model(list())) | ||
expect_error(as_epidist_marginal_model(sim_obs[, 1])) | ||
}) | ||
|
||
# Make this data available for other tests | ||
family_lognormal <- epidist_family(prep_obs, family = brms::lognormal()) | ||
|
||
test_that("is_epidist_marginal_model returns TRUE for correct input", { # nolint: line_length_linter. | ||
expect_true(is_epidist_marginal_model(prep_obs)) | ||
expect_true({ | ||
x <- list() | ||
class(x) <- "epidist_marginal_model" | ||
is_epidist_marginal_model(x) | ||
}) | ||
}) | ||
|
||
test_that("is_epidist_marginal_model returns FALSE for incorrect input", { # nolint: line_length_linter. | ||
expect_false(is_epidist_marginal_model(list())) | ||
expect_false({ | ||
x <- list() | ||
class(x) <- "epidist_marginal_model_extension" | ||
is_epidist_marginal_model(x) | ||
}) | ||
}) | ||
|
||
test_that("assert_epidist.epidist_marginal_model doesn't produce an error for correct input", { # nolint: line_length_linter. | ||
expect_no_error(assert_epidist(prep_obs)) | ||
}) | ||
|
||
test_that("assert_epidist.epidist_marginal_model returns FALSE for incorrect input", { # nolint: line_length_linter. | ||
expect_error(assert_epidist(list())) | ||
expect_error(assert_epidist(prep_obs[, 1])) | ||
expect_error({ | ||
x <- list() | ||
class(x) <- "epidist_marginal_model" | ||
assert_epidist(x) | ||
}) | ||
}) |