Skip to content

Commit

Permalink
Merge pull request #325 from MichaelChirico/patch-1
Browse files Browse the repository at this point in the history
Skip tests depending on Suggested dependency rstantools
  • Loading branch information
jgabry authored Jun 24, 2024
2 parents 11e4aa8 + 075eb52 commit 030cb2c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/testthat/test-ppc-errors.R
Original file line number Diff line number Diff line change
Expand Up @@ -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, ]))

Expand All @@ -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
Expand All @@ -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]))
Expand Down

0 comments on commit 030cb2c

Please sign in to comment.