Skip to content

Commit

Permalink
test output of evaluate_smooths
Browse files Browse the repository at this point in the history
  • Loading branch information
njtierney committed Dec 10, 2024
1 parent 8d9a1df commit 627b407
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
24 changes: 24 additions & 0 deletions tests/testthat/_snaps/evaluate-smooths.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,27 @@
Error in `evaluate_smooths()`:
! Can only evaluate smooths from greta arrays created with `greta.gam::smooths()`

---

Code
(eval_z <- evaluate_smooths(z, newdata = data.frame(x = x_plot)))
Message
greta array <operation>
Output
[,1]
[1,] ?
[2,] ?
[3,] ?
[4,] ?
[5,] ?
[6,] ?
[7,] ?
[8,] ?
[9,] ?
[10,] ?
Message
i 190 more values
Use `print(n = ...)` to see more values

9 changes: 7 additions & 2 deletions tests/testthat/test-evaluate-smooths.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ test_that("evaluate_smooths errors appropriately", {
error = TRUE,
evaluate_smooths("thing")
)
expect_no_error(
z_pred <- evaluate_smooths(z, newdata = data.frame(x = x_plot))
expect_snapshot(
(eval_z <- evaluate_smooths(z, newdata = data.frame(x = x_plot)))
)

expect_s3_class(
object = eval_z,
"greta_array"
)
})

0 comments on commit 627b407

Please sign in to comment.