diff --git a/tests/testthat/test-ppc-errors.R b/tests/testthat/test-ppc-errors.R index d6424b38..16e8fda0 100644 --- a/tests/testthat/test-ppc-errors.R +++ b/tests/testthat/test-ppc-errors.R @@ -4,6 +4,7 @@ context("PPC: predictive errors") source(test_path("data-for-ppc-tests.R")) test_that("ppc_error_hist and ppc_error_scatter return ggplot object", { + skip_if_not_installed("rstantools") expect_gg(ppc_error_hist(y, yrep[1:5, ], binwidth = 0.1)) expect_gg(ppc_error_scatter(y, yrep[1:5, ])) @@ -15,17 +16,20 @@ test_that("ppc_error_hist and ppc_error_scatter return ggplot object", { }) test_that("ppc_error_hist_grouped returns ggplot object", { + skip_if_not_installed("rstantools") expect_gg(ppc_error_hist_grouped(y, yrep[1:5, ], group, binwidth = 0.1)) expect_gg(ppc_error_hist_grouped(y, yrep[1,, drop = FALSE], group, freq = FALSE, binwidth = 1)) }) test_that("ppc_error_scatter_avg returns ggplot2 object", { + skip_if_not_installed("rstantools") expect_gg(ppc_error_scatter_avg(y, yrep)) expect_gg(ppc_error_scatter_avg(y, yrep[1:5, ])) }) test_that("ppc_error_scatter_avg same as ppc_error_scatter if nrow(yrep) = 1", { + skip_if_not_installed("rstantools") p1 <- ppc_error_scatter_avg(y2, yrep2) p2 <- ppc_error_scatter(y2, yrep2) d1 <- p1$data @@ -37,11 +41,13 @@ test_that("ppc_error_scatter_avg same as ppc_error_scatter if nrow(yrep) = 1", { }) test_that("ppc_error_scatter_avg_vs_x returns ggplot2 object", { + skip_if_not_installed("rstantools") expect_gg(ppc_error_scatter_avg_vs_x(y, yrep, x = rnorm(length(y)))) expect_gg(ppc_error_scatter_avg_vs_x(y, yrep[1:5, ], x = rnorm(length(y)))) }) test_that("ppc_error_binned returns ggplot object", { + skip_if_not_installed("rstantools") load(test_path("data-for-binomial.rda")) expect_gg(ppc_error_binned(y, Ey)) expect_gg(ppc_error_binned(y[1:5], Ey[, 1:5]))