From 393d574edcbda9d225a692a278a6802eec3b2ec8 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 4 Oct 2023 12:46:50 +0200 Subject: [PATCH] test --- tests/testthat/test-check_heterogeneity_bias.R | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/testthat/test-check_heterogeneity_bias.R b/tests/testthat/test-check_heterogeneity_bias.R index 3cfdec519..7abc6af30 100644 --- a/tests/testthat/test-check_heterogeneity_bias.R +++ b/tests/testthat/test-check_heterogeneity_bias.R @@ -6,6 +6,10 @@ test_that("check_heterogeneity_bias", { expect_equal(out, c("Sepal.Length", "Petal.Length"), ignore_attr = TRUE) expect_output(print(out), "Possible heterogeneity bias due to following predictors: Sepal\\.Length, Petal\\.Length") + out <- check_heterogeneity_bias(iris, select = ~ Sepal.Length + Petal.Length, group = ~ID) + expect_equal(out, c("Sepal.Length", "Petal.Length"), ignore_attr = TRUE) + expect_output(print(out), "Possible heterogeneity bias due to following predictors: Sepal\\.Length, Petal\\.Length") + m <- lm(Sepal.Length ~ Petal.Length + Petal.Width + Species + ID, data = iris) expect_error( check_heterogeneity_bias(m, select = c("Sepal.Length", "Petal.Length"), group = "ID"), @@ -20,4 +24,10 @@ test_that("check_heterogeneity_bias", { print(out), "Possible heterogeneity bias due to following predictors: Petal\\.Length, Petal\\.Width, Species" ) + out <- check_heterogeneity_bias(m, select = ~ Sepal.Length + Petal.Length, group = ~ID) + expect_equal(out, c("Petal.Length", "Petal.Width", "Species"), ignore_attr = TRUE) + expect_output( + print(out), + "Possible heterogeneity bias due to following predictors: Petal\\.Length, Petal\\.Width, Species" + ) })