From 5e25261e56b02b3ee7c7532bf92ef72660461627 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Sat, 1 Jul 2023 18:20:30 +0200 Subject: [PATCH] Add some tests --- tests/testthat/test_interact.R | 2 ++ tests/testthat/test_pdp.R | 1 + 2 files changed, 3 insertions(+) diff --git a/tests/testthat/test_interact.R b/tests/testthat/test_interact.R index bcfde7d1..eabdd5c8 100644 --- a/tests/testthat/test_interact.R +++ b/tests/testthat/test_interact.R @@ -9,6 +9,7 @@ test_that("Additive models show 0 interactions (univariate)", { ) expect_equal(H2(inter), 0) expect_s3_class(H2_j(inter), "ggplot") + expect_s3_class(plot(inter), "ggplot") }) test_that("Additive models show 0 interactions (multivariate)", { @@ -24,6 +25,7 @@ test_that("Additive models show 0 interactions (multivariate)", { ) expect_equal(H2(inter), c(Sepal.Length = 0, Sepal.Width = 0)) expect_s3_class(H2_j(inter), "ggplot") + expect_s3_class(plot(inter), "ggplot") }) test_that("Non-additive models show interactions > 0 (one interaction)", { diff --git a/tests/testthat/test_pdp.R b/tests/testthat/test_pdp.R index c70384b4..04f2a506 100644 --- a/tests/testthat/test_pdp.R +++ b/tests/testthat/test_pdp.R @@ -5,6 +5,7 @@ g <- 2:1 test_that("pd_raw() works for simple example", { pd <- pd_raw(1, v = "a", X = X, grid = g, pred_fun = pfun) expect_equal(pd, cbind(pred = g / 2)) + capture_output(expect_no_error(print(pd))) }) test_that("pd_raw() works on simple example with and without grid compression", {