Skip to content

Commit

Permalink
reduce size of some snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinsimpson committed Mar 26, 2024
1 parent 92f2fd0 commit 2be5c4f
Show file tree
Hide file tree
Showing 13 changed files with 3,087 additions and 12,205 deletions.
3,665 changes: 481 additions & 3,184 deletions tests/testthat/_snaps/diagnostic-plots/appraise-diagnostic-plots.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3,667 changes: 482 additions & 3,185 deletions tests/testthat/_snaps/diagnostic-plots/appraise-worm-plot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,134 changes: 119 additions & 1,015 deletions tests/testthat/_snaps/diagnostic-plots/worm-plot-gam-normal.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,144 changes: 124 additions & 1,020 deletions tests/testthat/_snaps/diagnostic-plots/worm-plot-gam-simulate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,128 changes: 115 additions & 1,013 deletions tests/testthat/_snaps/diagnostic-plots/worm-plot-gam-uniform.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,956 changes: 584 additions & 1,372 deletions ...estthat/_snaps/draw-methods/draw-simple-partial-residuals-with-fixed-scales.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2,003 changes: 600 additions & 1,403 deletions tests/testthat/_snaps/draw-methods/draw-simple-partial-residuals.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions tests/testthat/setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ library("ggplot2")
n_quick <- 300
quick_eg1 <- data_sim("eg1", n = n_quick, seed = 21)
quick_eg1_off <- quick_eg1 |> mutate(off = 2)
tiny_eg1 <- data_sim("eg1", n = 100, seed = 21)
su_eg1 <- data_sim("eg1", n = 1000, dist = "normal", scale = 2, seed = 1)
su_eg2 <- data_sim("eg2", n = 2000, dist = "normal", scale = 0.5, seed = 42)
su_eg3 <- data_sim("eg3", n = 400, seed = 32)
Expand All @@ -27,6 +28,11 @@ su_m_quick_eg1 <- gam(y ~ s(x0) + s(x1) + s(x2) + s(x3),
method = "REML"
)

m_tiny_eg1 <- gam(y ~ s(x0) + s(x1) + s(x2) + s(x3),
data = tiny_eg1,
method = "REML"
)

su_m_quick_eg1_shrink <- gam(
y ~ s(x0, bs = "ts") + s(x1, bs = "cs") +
s(x2, bs = "ts") + s(x3, bs = "ts"),
Expand Down
13 changes: 5 additions & 8 deletions tests/testthat/test-diagnostic-plots.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Test qq_plot() methods

test_that("appraise() works", {
plt <- appraise(m_gam)
plt <- appraise(m_tiny_eg1)

skip_on_ci()
expect_doppelganger("appraise diagnostic plots", plt)
Expand All @@ -12,9 +12,6 @@ test_that("appraise() method direct yields a message", {
plt <- appraise(m_gam, method = "direct"),
"`method = \"direct\"` is deprecated, use `\"uniform\"`"
)

skip_on_ci()
expect_doppelganger("appraise diagnostic plots", plt)
})

test_that("appraise() fails if n_bins not numeric or one of character options", {
Expand Down Expand Up @@ -44,13 +41,13 @@ test_that("residuals_hist_plot fails if non-numeric n_bins doesn't match charact
})

test_that("worm_plot works for a GAM", {
expect_silent(plt1 <- withr::with_seed(1, worm_plot(m_gam)))
expect_silent(plt1 <- withr::with_seed(1, worm_plot(m_tiny_eg1)))

expect_silent(plt2 <- withr::with_seed(1, worm_plot(m_gam,
expect_silent(plt2 <- withr::with_seed(1, worm_plot(m_tiny_eg1,
method = "simulate"
)))

expect_silent(plt3 <- withr::with_seed(1, worm_plot(m_gam,
expect_silent(plt3 <- withr::with_seed(1, worm_plot(m_tiny_eg1,
method = "normal"
)))

Expand Down Expand Up @@ -136,7 +133,7 @@ test_that("appraise works for a LM", {
})

test_that("appraise can use the worm plot", {
expect_silent(plt <- withr::with_seed(1, appraise(m_gam,
expect_silent(plt <- withr::with_seed(1, appraise(m_tiny_eg1,
use_worm = TRUE,
method = "simulate"
)))
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-draw-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ test_that("draw.gam() plots a simple multi-smooth AM", {
})

test_that("draw.gam() can draw partial residuals", {
plt1 <- draw(su_m_quick_eg1, residuals = TRUE, rug = FALSE)
plt2 <- draw(su_m_quick_eg1, residuals = TRUE, scales = "fixed", rug = FALSE)
plt1 <- draw(m_tiny_eg1, residuals = TRUE, rug = FALSE)
plt2 <- draw(m_tiny_eg1, residuals = TRUE, scales = "fixed", rug = FALSE)

skip_on_ci()
expect_doppelganger("draw simple partial residuals", plt1)
Expand Down
10 changes: 7 additions & 3 deletions tests/testthat/test-draw-smooth-estimates.R
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,15 @@ test_that("grouped_by works", {
test_that("draw smooth estimates works with sizer", {
expect_silent(d <- derivatives(m_gam, n = 100))
expect_silent(plt1 <- smooth_estimates(m_gam) |>
add_sizer(derivatives = d, type = "change"))
add_sizer(derivatives = d, type = "change") |>
draw()
)
expect_silent(plt2 <- smooth_estimates(m_gam) |>
add_sizer(derivatives = d, type = "sizer"))
add_sizer(derivatives = d, type = "sizer") |>
draw()
)

skip_on_cran()
expect_doppelganger("draw smooth est works with change indicators", plt1)
expect_doppelganger("draw smooth est works with sizer indicators", plt2)
})
})

0 comments on commit 2be5c4f

Please sign in to comment.