Skip to content

Commit bda7a93

Browse files
committed
suppress warnings about bounds in tests
1 parent a59f841 commit bda7a93

6 files changed

Lines changed: 453 additions & 22 deletions

File tree

tests/testthat/_snaps/mcmc-distributions/mcmc-dens-bounds.svg

Lines changed: 187 additions & 0 deletions
Loading

tests/testthat/_snaps/mcmc-distributions/mcmc-dens-overlay-bounds.svg

Lines changed: 102 additions & 0 deletions
Loading

tests/testthat/_snaps/ppc-distributions/ppc-dens-overlay-bounds.svg

Lines changed: 75 additions & 0 deletions
Loading

tests/testthat/_snaps/ppc-distributions/ppd-dens-overlay-bounds.svg

Lines changed: 67 additions & 0 deletions
Loading

tests/testthat/test-mcmc-distributions.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ test_that("mcmc_dens_overlay returns a ggplot object", {
5656
})
5757

5858
test_that("mcmc density plots accept bounds", {
59-
expect_gg(mcmc_dens(arr, pars = "beta[1]", bounds = c(0, Inf)))
60-
expect_gg(mcmc_dens_overlay(arr, pars = "beta[1]", bounds = c(0, Inf)))
61-
expect_gg(mcmc_dens_chains(arr, pars = "beta[1]", bounds = c(0, Inf)))
59+
suppressWarnings(expect_gg(mcmc_dens(arr, pars = "beta[1]", bounds = c(0, Inf))))
60+
suppressWarnings(expect_gg(mcmc_dens_overlay(arr, pars = "beta[1]", bounds = c(0, Inf))))
61+
suppressWarnings(expect_gg(mcmc_dens_chains(arr, pars = "beta[1]", bounds = c(0, Inf))))
6262
})
6363

6464
test_that("mcmc_dens_chains returns a ggplot object", {
@@ -151,7 +151,7 @@ test_that("mcmc_dens renders correctly", {
151151
vdiffr::expect_doppelganger("mcmc_dens (alpha)", p_alpha)
152152

153153
p_bounds <- suppressWarnings(mcmc_dens(vdiff_dframe, bounds = c(0, Inf)))
154-
vdiffr::expect_doppelganger("mcmc_dens (bounds)", p_bounds)
154+
suppressWarnings(vdiffr::expect_doppelganger("mcmc_dens (bounds)", p_bounds))
155155
})
156156

157157
test_that("mcmc_dens_overlay renders correctly", {
@@ -163,7 +163,7 @@ test_that("mcmc_dens_overlay renders correctly", {
163163
vdiffr::expect_doppelganger("mcmc_dens_overlay (default)", p_base)
164164

165165
p_bounds <- suppressWarnings(mcmc_dens_overlay(vdiff_dframe_chains, bounds = c(1,2)))
166-
vdiffr::expect_doppelganger("mcmc_dens_overlay (bounds)", p_bounds)
166+
suppressWarnings(vdiffr::expect_doppelganger("mcmc_dens_overlay (bounds)", p_bounds))
167167
})
168168

169169
test_that("mcmc_dens_chains renders correctly", {

tests/testthat/test-ppc-distributions.R

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ test_that("ppc_dens_overlay returns a ggplot object", {
1010
})
1111

1212
test_that("density PPC/PPD plots accept bounds", {
13-
expect_gg(ppc_dens(y, yrep[1:8, ], bounds = c(0, Inf)))
14-
expect_gg(ppc_dens_overlay(y, yrep, bounds = c(0, Inf)))
15-
expect_gg(ppc_dens_overlay_grouped(y, yrep, group = group, bounds = c(0, Inf)))
16-
expect_gg(ppd_dens(yrep[1:8, ], bounds = c(0, Inf)))
17-
expect_gg(ppd_dens_overlay(yrep, bounds = c(0, Inf)))
13+
suppressWarnings(expect_gg(ppc_dens(y, yrep[1:8, ], bounds = c(0, Inf))))
14+
suppressWarnings(expect_gg(ppc_dens_overlay(y, yrep, bounds = c(0, Inf))))
15+
suppressWarnings(expect_gg(ppc_dens_overlay_grouped(y, yrep, group = group, bounds = c(0, Inf))))
16+
suppressWarnings(expect_gg(ppd_dens(yrep[1:8, ], bounds = c(0, Inf))))
17+
suppressWarnings(expect_gg(ppd_dens_overlay(yrep, bounds = c(0, Inf))))
1818
})
1919

2020
test_that("ppc_ecdf_overlay returns a ggplot object", {
@@ -208,30 +208,30 @@ test_that("ppc_dots renders correctly", {
208208
vdiffr::expect_doppelganger("ppc_dots (default)", p_base)
209209

210210
p_binwidth <- ppc_dots(vdiff_y, vdiff_yrep[1:8, ], binwidth = 3)
211-
expect_warning(vdiffr::expect_doppelganger("ppc_dots (binwidth)", p_binwidth),
212-
"The provided binwidth will cause dots to overflow the boundaries")
211+
suppressWarnings(expect_warning(vdiffr::expect_doppelganger("ppc_dots (binwidth)", p_binwidth),
212+
"The provided binwidth will cause dots to overflow the boundaries"))
213213

214214
p_quantile <- ppc_dots(vdiff_y, vdiff_yrep[1:8, ], quantiles = 50)
215215
vdiffr::expect_doppelganger("ppc_dots (quantile)", p_quantile)
216216

217217
p_quantile_binwidth <- ppc_dots(vdiff_y, vdiff_yrep[1:8, ], binwidth = 3, quantiles = 50)
218-
expect_warning(vdiffr::expect_doppelganger("ppc_dots (quantile-binwidth)", p_quantile_binwidth),
219-
"The provided binwidth will cause dots to overflow the boundaries")
218+
suppressWarnings(expect_warning(vdiffr::expect_doppelganger("ppc_dots (quantile-binwidth)", p_quantile_binwidth),
219+
"The provided binwidth will cause dots to overflow the boundaries"))
220220

221221
# ppd versions
222222
p_base <- ppd_dots(vdiff_yrep[1:8, ])
223223
vdiffr::expect_doppelganger("ppd_dots (default)", p_base)
224224

225-
p_binwidth <- ppd_dots(vdiff_yrep[1:8, ], binwidth = 3)
226-
expect_warning(vdiffr::expect_doppelganger("ppd_dots (binwidth)", p_binwidth),
227-
"The provided binwidth will cause dots to overflow the boundaries")
225+
p_binwidth <- suppressWarnings(ppd_dots(vdiff_yrep[1:8, ], binwidth = 3))
226+
suppressWarnings(expect_warning(vdiffr::expect_doppelganger("ppd_dots (binwidth)", p_binwidth),
227+
"The provided binwidth will cause dots to overflow the boundaries"))
228228

229229
p_quantile <- ppd_dots(vdiff_yrep[1:8, ], quantiles = 50)
230230
vdiffr::expect_doppelganger("ppd_dots (quantile)", p_quantile)
231231

232-
p_quantile_binwidth <- ppd_dots(vdiff_yrep[1:8, ], binwidth = 3, quantiles = 50)
233-
expect_warning(vdiffr::expect_doppelganger("ppd_dots (quantile-binwidth)", p_quantile_binwidth),
234-
"The provided binwidth will cause dots to overflow the boundaries")
232+
p_quantile_binwidth <- suppressWarnings(ppd_dots(vdiff_yrep[1:8, ], binwidth = 3, quantiles = 50))
233+
suppressWarnings(expect_warning(vdiffr::expect_doppelganger("ppd_dots (quantile-binwidth)", p_quantile_binwidth),
234+
"The provided binwidth will cause dots to overflow the boundaries"))
235235
})
236236

237237
test_that("ppc_ecdf_overlay renders correctly", {
@@ -304,7 +304,7 @@ test_that("ppc_dens_overlay renders correctly", {
304304
vdiffr::expect_doppelganger("ppc_dens_overlay (alpha, size)", p_custom)
305305

306306
p_bounds <- suppressWarnings(ppc_dens_overlay(vdiff_y, vdiff_yrep, bounds = c(0, Inf)))
307-
vdiffr::expect_doppelganger("ppc_dens_overlay (bounds)", p_bounds)
307+
suppressWarnings(vdiffr::expect_doppelganger("ppc_dens_overlay (bounds)", p_bounds))
308308

309309
# ppd versions
310310
p_base <- ppd_dens_overlay(vdiff_yrep)
@@ -314,7 +314,7 @@ test_that("ppc_dens_overlay renders correctly", {
314314
vdiffr::expect_doppelganger("ppd_dens_overlay (alpha, size)", p_custom)
315315

316316
p_bounds <- suppressWarnings(ppd_dens_overlay(vdiff_yrep, bounds = c(0, Inf)))
317-
vdiffr::expect_doppelganger("ppd_dens_overlay (bounds)", p_bounds)
317+
suppressWarnings(vdiffr::expect_doppelganger("ppd_dens_overlay (bounds)", p_bounds))
318318
})
319319

320320
test_that("ppc_dens_overlay_grouped renders correctly", {

0 commit comments

Comments
 (0)