Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add test for check_stan_model #461

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions packages/taxdat/tests/testthat/test_setup_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -724,8 +724,6 @@ test_that("check_stan_iter_sampling works",{

})

## check_snap_tol, check_use_pop_weight, check_sfrac_thresh, check_ingest_covariates, check_ingest_new_covariates, check_stan_debug, check_stan_model, get_all_config_options, check_update_config

test_that("get_all_config_options works",{
config_options <- get_all_config_options()

Expand Down Expand Up @@ -901,4 +899,21 @@ test_that("check_stan_debug works", {
expect_error(check_stan_debug(debug = config_error$debug),
"Debug needs to be logical")
})

test_that("check_stan_model works", {
exist <- paste0("/home/usr/cholera_mapping_pipeline/Analysis/Stan/",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We no longer have a Stan file of this name in the dev repo
Better to use this file name Analysis/Stan/mapping_model_inference.stan

"mapping_model_inference_normal_nocensprior_fixedadm0_mix_sigmainf.stan")
mock_file_exists <- function(file) {
if (file == exist) {
return(TRUE)
} else {
return(FALSE)
}
}
stan_dir <- "/home/usr/cholera_mapping_pipeline/Analysis/Stan/"
testthat::with_mock(file.exists = mock_file_exists, {
expect_equal(check_stan_model(exist, stan_dir), exist)
expect_error(check_stan_model("not_exist", "stan_dir"))
})
})
##check_stan_model, check_update_config