-
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.
add some tests for the generic transform data method
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
test_that( | ||
"epidist_transform_data with default settings returns data unchanged", | ||
{ | ||
family <- epidist_family(prep_obs, family = lognormal()) | ||
formula <- epidist_formula(prep_obs, family = family, formula = bf(mu ~ 1)) | ||
|
||
transformed <- epidist_transform_data(prep_obs, family, formula) | ||
expect_identical(transformed, prep_obs) | ||
} | ||
) | ||
|
||
test_that("epidist_transform_data errors when passed incorrect inputs", { | ||
family <- epidist_family(prep_obs, family = lognormal()) | ||
formula <- epidist_formula(prep_obs, family = family, formula = bf(mu ~ 1)) | ||
|
||
expect_error(epidist_transform_data(list(), family, formula)) | ||
}) | ||
|
||
test_that("epidist_transform_data_model.default returns data unchanged", { | ||
family <- epidist_family(prep_obs, family = lognormal()) | ||
formula <- epidist_formula(prep_obs, family = family, formula = bf(mu ~ 1)) | ||
|
||
transformed <- epidist_transform_data_model(prep_obs, family, formula) | ||
expect_identical(transformed, prep_obs) | ||
}) | ||
|
||
test_that("epidist_transform_data works with different model types", { | ||
family <- epidist_family(prep_obs, family = lognormal()) | ||
formula <- epidist_formula(prep_obs, family = family, formula = bf(mu ~ 1)) | ||
|
||
expect_identical( | ||
epidist_transform_data(prep_naive_obs, family, formula), | ||
prep_naive_obs | ||
) | ||
expect_identical( | ||
epidist_transform_data(prep_obs_gamma, family, formula), | ||
prep_obs_gamma | ||
) | ||
}) |