From 66a3b58e64a9523bf68de05b7c73cb4421a62cfd Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 12 Sep 2023 18:46:47 +0300 Subject: [PATCH] Additional test fixes --- tests/testthat/test-fit-mle.R | 2 +- tests/testthat/test-model-compile.R | 18 +++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/tests/testthat/test-fit-mle.R b/tests/testthat/test-fit-mle.R index 40fddc2bc..f5828a60d 100644 --- a/tests/testthat/test-fit-mle.R +++ b/tests/testthat/test-fit-mle.R @@ -53,7 +53,7 @@ test_that("time is reported after optimization", { test_that("no error when checking estimates after failure", { fit <- cmdstanr_example("schools", method = "optimize", seed = 123) # optim ålways fails for this - expect_silent(fit$summary()) # no error + expect_silent(fit$summary(include_failed = TRUE)) # no error }) test_that("draws() works for different formats", { diff --git a/tests/testthat/test-model-compile.R b/tests/testthat/test-model-compile.R index 3134bbc0b..8fae1a026 100644 --- a/tests/testthat/test-model-compile.R +++ b/tests/testthat/test-model-compile.R @@ -424,14 +424,14 @@ test_that("check_syntax() works with pedantic=TRUE", { " stan_file <- write_stan_file(model_code) mod_dep_warning <- cmdstan_model(stan_file, compile = FALSE) - expect_message( + expect_error( mod_dep_warning$compile(), - "deprecated in the Stan language", + "An error occured during compilation! See the message above for more information.", fixed = TRUE ) - expect_message( + expect_error( mod_dep_warning$check_syntax(), - "deprecated in the Stan language", + "Syntax error found! See the message above for more information.", fixed = TRUE ) }) @@ -690,13 +690,9 @@ test_that("format() works", { stan_file_tmp <- write_stan_file(code) mod_1 <- cmdstan_model(stan_file_tmp, compile = FALSE) - expect_output( - expect_message( - mod_1$format(), - "is deprecated", - fixed = TRUE - ), - "target += normal_log(y, 0, 1);", + expect_error( + mod_1$format(), + "Syntax error found! See the message above for more information.", fixed = TRUE )