Skip to content

Commit

Permalink
predict.weightedMeanLearner: 100% test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
fouodo committed Jul 19, 2024
1 parent d287845 commit 051f3d6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 0 additions & 1 deletion .covrignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
./R/NewLayer.R
./R/NewMetaLayer.R
./R/NewStudy.R
./R/predict.weightedMeanLearner.R
./R/PredictData.R
./R/PredictLayer.R
./R/PredictMetaLayer.R
Expand Down
10 changes: 10 additions & 0 deletions tests/testthat/test-weightedMeanLearner.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ test_that("weightedMeanLearner works", {
x = data.frame(x1 = rnorm(50L))
y = sample(x = 0L:1L, size = 50L, replace = TRUE)
my_model = weightedMeanLearner(x = x, y = y)
x_new <- data.frame(x1 = rnorm(10))
my_predictions <- predict(object = my_model, data = x_new)
})
expect_error({
set.seed(20240624L)
x = data.frame(x1 = rnorm(50L))
y = sample(x = 0L:1L, size = 50L, replace = TRUE)
my_model = weightedMeanLearner(x = x, y = y)
x_new <- data.frame(x2 = rnorm(10))
my_predictions <- predict(object = my_model, data = x_new)
})
expect_error({
set.seed(20240624L)
Expand Down

0 comments on commit 051f3d6

Please sign in to comment.