Skip to content

Commit a911bfa

Browse files
committed
add error message test to expect_error
1 parent ac0b423 commit a911bfa

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/testthat/test_pipeop_learnerpicvplus.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ test_that("PipeOpLearnerPICVPlus - basic properties", {
4444
expect_true(nrow(prds$output$quantiles) == task$nrow)
4545
expect_equal(dim(prds$output$quantiles), c(task$nrow, 2)) # lower and upper quantiles
4646

47-
expect_error(PipeOpLearnerPICVPlus$new())
47+
expect_error(PipeOpLearnerPICVPlus$new(), "learner")
4848

4949
expect_pipeop(po("learner_pi_cvplus", lrn("regr.featureless")))
5050
})
5151

52-
test_that("PipeOpLearnerPICVPlus - param set and values", { ####
52+
test_that("PipeOpLearnerPICVPlus - param set and values", {
5353
skip_if_not_installed("rpart")
5454
lrn = mlr_learners$get("regr.rpart")
5555
po = PipeOpLearnerPICVPlus$new(lrn)
@@ -63,11 +63,11 @@ test_that("PipeOpLearnerPICVPlus - param set and values", { ####
6363
po$param_set$values$cvplus.folds = 5
6464
expect_equal(po$param_set$values, list(cvplus.folds = 5, cvplus.alpha = 0.05, minsplit = 2, xval = 0))
6565

66-
expect_error(PipeOpLearnerPICVPlus$new(lrn, param_vals = list(cvplus.folds = 1)))
67-
expect_error(PipeOpLearnerPICVPlus$new(lrn, param_vals = list(cvplus.alpha = -1)))
66+
expect_error(PipeOpLearnerPICVPlus$new(lrn, param_vals = list(cvplus.folds = 1)), "is not >= 1")
67+
expect_error(PipeOpLearnerPICVPlus$new(lrn, param_vals = list(cvplus.alpha = -1)), "is not >= -")
6868

6969
lrn_classif = mlr_learners$get("classif.featureless")
70-
expect_error(PipeOpLearnerPICVPlus$new(lrn_classif))
70+
expect_error(PipeOpLearnerPICVPlus$new(lrn_classif), "only supports regression")
7171
})
7272

7373
test_that("PipeOpLearnerPICVPlus - graph but no id", {

0 commit comments

Comments
 (0)