From 627b40722f970b60dcfb6bba379af0ce5e771d49 Mon Sep 17 00:00:00 2001 From: njtierney Date: Tue, 10 Dec 2024 16:35:52 +1100 Subject: [PATCH] test output of evaluate_smooths --- tests/testthat/_snaps/evaluate-smooths.md | 24 +++++++++++++++++++++++ tests/testthat/test-evaluate-smooths.R | 9 +++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/tests/testthat/_snaps/evaluate-smooths.md b/tests/testthat/_snaps/evaluate-smooths.md index e55c9a7..a9d42df 100644 --- a/tests/testthat/_snaps/evaluate-smooths.md +++ b/tests/testthat/_snaps/evaluate-smooths.md @@ -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 + + Output + [,1] + [1,] ? + [2,] ? + [3,] ? + [4,] ? + [5,] ? + [6,] ? + [7,] ? + [8,] ? + [9,] ? + [10,] ? + Message + + i 190 more values + Use `print(n = ...)` to see more values + diff --git a/tests/testthat/test-evaluate-smooths.R b/tests/testthat/test-evaluate-smooths.R index 49cdf83..e123b62 100644 --- a/tests/testthat/test-evaluate-smooths.R +++ b/tests/testthat/test-evaluate-smooths.R @@ -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" ) })