Skip to content

Commit 782265b

Browse files
committed
test
1 parent 7d9d548 commit 782265b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/testthat/test-estimate_expectation.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ test_that("estimate_expectation - data-grid", {
4343
colnames(estim),
4444
c("Predicted", "SE", "CI_low", "CI_high", "Residuals")
4545
)
46+
estim2 <- estimate_expectation(m, by = "cyl")
47+
expect_equal(estim$cyl, esimt2$cyl, tolerance = 1e-4)
48+
expect_equal(estim$Predicted, esimt2$Predicted, tolerance = 1e-4)
4649

4750
m <- lm(mpg ~ cyl, data = mtcars)
4851
estim <- estimate_expectation(m, data = "grid")
@@ -60,3 +63,12 @@ test_that("estimate_expectation - data-grid", {
6063
c("cyl", "Predicted", "SE", "CI_low", "CI_high")
6164
)
6265
})
66+
67+
68+
test_that("estimate_expectation - error", {
69+
m <- lm(mpg ~ cyl, data = mtcars)
70+
expect_error(
71+
estimate_expectation(m, data = mtcars, by = "cyl"),
72+
regex = "You can only"
73+
)
74+
})

0 commit comments

Comments
 (0)