Skip to content

Commit 8707a04

Browse files
committed
More test fixes
1 parent 66a3b58 commit 8707a04

2 files changed

Lines changed: 9 additions & 16 deletions

File tree

tests/testthat/test-fit-mle.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ test_that("time is reported after optimization", {
5353

5454
test_that("no error when checking estimates after failure", {
5555
fit <- cmdstanr_example("schools", method = "optimize", seed = 123) # optim ålways fails for this
56-
expect_silent(fit$summary(include_failed = TRUE)) # no error
56+
expect_error(fit$summary(), "Fitting failed. Unable to retrieve the draws.")
5757
})
5858

5959
test_that("draws() works for different formats", {

tests/testthat/test-model-compile.R

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ test_that("compile() works with pedantic=TRUE", {
278278
}
279279
")
280280
expect_message(
281-
mod_pedantic_warn <- cmdstan_model(stan_file, pedantic = TRUE),
281+
mod_pedantic_warn <- cmdstan_model(stan_file, pedantic = TRUE, force_recompile = TRUE),
282282
"The parameter x was declared but was not used",
283283
fixed = TRUE
284284
)
@@ -387,13 +387,10 @@ test_that("check_syntax() works with pedantic=TRUE", {
387387
fixed = TRUE
388388
)
389389

390-
expect_output(
391-
expect_message(
392-
mod_pedantic_warn$check_syntax(pedantic = TRUE),
393-
"The parameter x was declared but was not used",
394-
fixed = TRUE
395-
),
396-
regexp = NA
390+
expect_message(
391+
mod_pedantic_warn$check_syntax(pedantic = TRUE),
392+
"The parameter x was declared but was not used",
393+
fixed = TRUE
397394
)
398395
})
399396

@@ -706,13 +703,9 @@ test_that("format() works", {
706703
"target += normal_lpdf(y | 0, 1);",
707704
fixed = TRUE
708705
)
709-
expect_output(
710-
expect_message(
711-
mod_1$format(canonicalize = list("includes")),
712-
"is deprecated",
713-
fixed = TRUE
714-
),
715-
"target += normal_log(y, 0, 1);",
706+
expect_error(
707+
mod_1$format(),
708+
"Syntax error found! See the message above for more information.",
716709
fixed = TRUE
717710
)
718711

0 commit comments

Comments
 (0)