Skip to content

Commit

Permalink
fix tests after insight-update
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Feb 11, 2025
1 parent 475813a commit b04ea19
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 28 deletions.
23 changes: 11 additions & 12 deletions tests/testthat/_snaps/plot/plot-cat-num-predictor-3.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 11 additions & 12 deletions tests/testthat/_snaps/plot/plot-cat-num-predictor-4.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 61 additions & 0 deletions tests/testthat/_snaps/plot/plot-cat-num-predictor-5.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/testthat/test-estimate_expectation.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ test_that("estimate_expectation - data-grid", {

m <- lm(mpg ~ cyl, data = mtcars)
estim <- estimate_expectation(m, data = "grid")
expect_identical(dim(estim), c(10L, 5L))
expect_identical(dim(estim), c(3L, 5L))
expect_named(
estim,
c("cyl", "Predicted", "SE", "CI_low", "CI_high")
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-estimate_predicted.R
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ test_that("estimate_expectation - Frequentist", {

model <- lme4::lmer(wt ~ cyl + (1 | gear), data = data)
estim <- estimate_link(model)
expect_equal(dim(estim), c(10, 6))
expect_identical(dim(estim), c(3L, 6L))
estim <- estimate_expectation(model)
expect_equal(dim(estim), c(32, 7))

model <- lme4::glmer(vs ~ cyl + (1 | gear), data = data, family = "binomial")
estim <- estimate_link(model)
expect_equal(dim(estim), c(10, 6))
expect_identical(dim(estim), c(3L, 6L))
estim <- estimate_expectation(model)
expect_equal(dim(estim), c(32, 7))
})
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-multivariate_response.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ test_that("multivariate response", {
expect_identical(dim(out), c(64L, 4L))

out <- estimate_expectation(fm1, by = "cyl")
expect_identical(dim(out), c(20L, 4L))
expect_identical(dim(out), c(6L, 4L))
})
6 changes: 6 additions & 0 deletions tests/testthat/test-plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,12 @@ test_that("plots, numeric or categorical predictors are detected", {
"plot-cat-num-predictor-4",
plot(pr, show_data = FALSE)
)
pr <- estimate_expectation(m_cat, by = "cyl", range = "grid")
set.seed(123)
vdiffr::expect_doppelganger(
"plot-cat-num-predictor-5",
plot(pr, show_data = FALSE)
)
})


Expand Down

0 comments on commit b04ea19

Please sign in to comment.