diff --git a/.github/workflows/pkgdown.yml b/.github/workflows/pkgdown.yml
index 0e935d7f2..9a21455dc 100644
--- a/.github/workflows/pkgdown.yml
+++ b/.github/workflows/pkgdown.yml
@@ -44,7 +44,7 @@ jobs:
- name: Deploy
if: github.event_name != 'pull_request'
- uses: JamesIves/github-pages-deploy-action@v4.6.9
+ uses: JamesIves/github-pages-deploy-action@v4.7.2
with:
clean: false
branch: gh-pages
diff --git a/DESCRIPTION b/DESCRIPTION
index 8b61ae016..4109f29a7 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -71,7 +71,7 @@ Suggests:
remotes,
RhpcBLASctl,
rpart,
- testthat (>= 3.1.0)
+ testthat (>= 3.2.0)
Encoding: UTF-8
Config/testthat/edition: 3
Config/testthat/parallel: false
diff --git a/R/Learner.R b/R/Learner.R
index 72014c8f5..d1b7e7863 100644
--- a/R/Learner.R
+++ b/R/Learner.R
@@ -504,6 +504,50 @@ Learner = R6Class("Learner",
private$.encapsulation = c(train = method, predict = method)
private$.fallback = fallback
+ return(invisible(self))
+ },
+
+ #' @description
+ #' Sets parameter values and fields of the learner.
+ #' All arguments whose names match the name of a parameter of the [paradox::ParamSet] are set as parameters.
+ #' All remaining arguments are assumed to be regular fields.
+ #'
+ #' @param ... (named `any`)\cr
+ #' Named arguments to set parameter values and fields.
+ #' @param .values (named `any`)\cr
+ #' Named list of parameter values and fields.
+ configure = function(..., .values = list()) {
+ dots = list(...)
+ assert_list(dots, names = "unique")
+ assert_list(.values, names = "unique")
+ assert_disjunct(names(dots), names(.values))
+ new_values = insert_named(dots, .values)
+
+ # set params in ParamSet
+ if (length(new_values)) {
+ param_ids = self$param_set$ids()
+ ii = names(new_values) %in% param_ids
+ if (any(ii)) {
+ self$param_set$values = insert_named(self$param_set$values, new_values[ii])
+ new_values = new_values[!ii]
+ }
+ } else {
+ param_ids = character()
+ }
+
+ # remaining args go into fields
+ if (length(new_values)) {
+ ndots = names(new_values)
+ for (i in seq_along(new_values)) {
+ nn = ndots[[i]]
+ if (!exists(nn, envir = self, inherits = FALSE)) {
+ stopf("Cannot set argument '%s' for '%s' (not a parameter, not a field).%s",
+ nn, class(self)[1L], did_you_mean(nn, c(param_ids, setdiff(names(self), ".__enclos_env__")))) # nolint
+ }
+ self[[nn]] = new_values[[i]]
+ }
+ }
+
return(invisible(self))
}
),
diff --git a/inst/testthat/helper_expectations.R b/inst/testthat/helper_expectations.R
index c7656defb..d6c2ca1b0 100644
--- a/inst/testthat/helper_expectations.R
+++ b/inst/testthat/helper_expectations.R
@@ -517,7 +517,7 @@ expect_measure = function(m) {
testthat::expect_output(print(m), "Measure")
if ("requires_no_prediction" %in% m$properties) {
- testthat::expect_true(is.null(m$predict_sets))
+ testthat::expect_null(m$predict_sets)
}
expect_id(m$id)
diff --git a/man/Learner.Rd b/man/Learner.Rd
index fee67c15a..f5ede1944 100644
--- a/man/Learner.Rd
+++ b/man/Learner.Rd
@@ -318,6 +318,7 @@ Stores \code{HotstartStack}.}
\item \href{#method-Learner-reset}{\code{Learner$reset()}}
\item \href{#method-Learner-base_learner}{\code{Learner$base_learner()}}
\item \href{#method-Learner-encapsulate}{\code{Learner$encapsulate()}}
+\item \href{#method-Learner-configure}{\code{Learner$configure()}}
\item \href{#method-Learner-clone}{\code{Learner$clone()}}
}
}
@@ -608,6 +609,29 @@ The fallback learner for failed predictions.}
}
}
\if{html}{\out{
}}
+\if{html}{\out{}}
+\if{latex}{\out{\hypertarget{method-Learner-configure}{}}}
+\subsection{Method \code{configure()}}{
+Sets parameter values and fields of the learner.
+All arguments whose names match the name of a parameter of the \link[paradox:ParamSet]{paradox::ParamSet} are set as parameters.
+All remaining arguments are assumed to be regular fields.
+\subsection{Usage}{
+\if{html}{\out{}}\preformatted{Learner$configure(..., .values = list())}\if{html}{\out{
}}
+}
+
+\subsection{Arguments}{
+\if{html}{\out{}}
+\describe{
+\item{\code{...}}{(named \code{any})\cr
+Named arguments to set parameter values and fields.}
+
+\item{\code{.values}}{(named \code{any})\cr
+Named list of parameter values and fields.}
+}
+\if{html}{\out{
}}
+}
+}
+\if{html}{\out{
}}
\if{html}{\out{}}
\if{latex}{\out{\hypertarget{method-Learner-clone}{}}}
\subsection{Method \code{clone()}}{
diff --git a/man/LearnerClassif.Rd b/man/LearnerClassif.Rd
index a62e3b668..64a29cf74 100644
--- a/man/LearnerClassif.Rd
+++ b/man/LearnerClassif.Rd
@@ -85,6 +85,7 @@ Other Learner:
Inherited methods
mlr3::Learner$base_learner()
+mlr3::Learner$configure()
mlr3::Learner$encapsulate()
mlr3::Learner$format()
mlr3::Learner$help()
diff --git a/man/LearnerRegr.Rd b/man/LearnerRegr.Rd
index 8d4273ad7..dca2085c7 100644
--- a/man/LearnerRegr.Rd
+++ b/man/LearnerRegr.Rd
@@ -89,6 +89,7 @@ The quantile to be used as response.}
Inherited methods
mlr3::Learner$base_learner()
+mlr3::Learner$configure()
mlr3::Learner$encapsulate()
mlr3::Learner$format()
mlr3::Learner$help()
diff --git a/man/mlr_learners_classif.debug.Rd b/man/mlr_learners_classif.debug.Rd
index 7e35a7209..a6e5ca749 100644
--- a/man/mlr_learners_classif.debug.Rd
+++ b/man/mlr_learners_classif.debug.Rd
@@ -153,6 +153,7 @@ a ratio in $(0, 1)$, \code{"test"}, or \code{"predefined"}.}
Inherited methods
mlr3::Learner$base_learner()
+mlr3::Learner$configure()
mlr3::Learner$encapsulate()
mlr3::Learner$format()
mlr3::Learner$help()
diff --git a/man/mlr_learners_classif.featureless.Rd b/man/mlr_learners_classif.featureless.Rd
index 5057db001..cf9724c9a 100644
--- a/man/mlr_learners_classif.featureless.Rd
+++ b/man/mlr_learners_classif.featureless.Rd
@@ -95,6 +95,7 @@ Other Learner:
Inherited methods
mlr3::Learner$base_learner()
+mlr3::Learner$configure()
mlr3::Learner$encapsulate()
mlr3::Learner$format()
mlr3::Learner$help()
diff --git a/man/mlr_learners_classif.rpart.Rd b/man/mlr_learners_classif.rpart.Rd
index 7a05986f5..10ba22be9 100644
--- a/man/mlr_learners_classif.rpart.Rd
+++ b/man/mlr_learners_classif.rpart.Rd
@@ -109,6 +109,7 @@ Other Learner:
Inherited methods
mlr3::Learner$base_learner()
+mlr3::Learner$configure()
mlr3::Learner$encapsulate()
mlr3::Learner$format()
mlr3::Learner$help()
diff --git a/man/mlr_learners_regr.debug.Rd b/man/mlr_learners_regr.debug.Rd
index 4aed04ae2..db69f57c4 100644
--- a/man/mlr_learners_regr.debug.Rd
+++ b/man/mlr_learners_regr.debug.Rd
@@ -102,6 +102,7 @@ Other Learner:
Inherited methods
mlr3::Learner$base_learner()
+mlr3::Learner$configure()
mlr3::Learner$encapsulate()
mlr3::Learner$format()
mlr3::Learner$help()
diff --git a/man/mlr_learners_regr.featureless.Rd b/man/mlr_learners_regr.featureless.Rd
index 960feb735..4cd8de85e 100644
--- a/man/mlr_learners_regr.featureless.Rd
+++ b/man/mlr_learners_regr.featureless.Rd
@@ -84,6 +84,7 @@ Other Learner:
Inherited methods
mlr3::Learner$base_learner()
+mlr3::Learner$configure()
mlr3::Learner$encapsulate()
mlr3::Learner$format()
mlr3::Learner$help()
diff --git a/man/mlr_learners_regr.rpart.Rd b/man/mlr_learners_regr.rpart.Rd
index ffcbd9d68..359d5d10d 100644
--- a/man/mlr_learners_regr.rpart.Rd
+++ b/man/mlr_learners_regr.rpart.Rd
@@ -109,6 +109,7 @@ Other Learner:
Inherited methods
mlr3::Learner$base_learner()
+mlr3::Learner$configure()
mlr3::Learner$encapsulate()
mlr3::Learner$format()
mlr3::Learner$help()
diff --git a/tests/testthat/teardown.R b/tests/testthat/teardown.R
index 37d74ec6d..79053fe7e 100644
--- a/tests/testthat/teardown.R
+++ b/tests/testthat/teardown.R
@@ -1,4 +1,3 @@
options(old_opts)
lg$set_threshold(old_threshold)
future::plan(old_plan)
-file.remove("tests/testthat/Rplots.pdf")
diff --git a/tests/testthat/test_DataBackendRbind.R b/tests/testthat/test_DataBackendRbind.R
index d859c3f18..96fc1a6bd 100644
--- a/tests/testthat/test_DataBackendRbind.R
+++ b/tests/testthat/test_DataBackendRbind.R
@@ -19,9 +19,9 @@ test_that("DataBackendRbind", {
# all col-hashes are mutually disjoint
- expect_true(length(intersect(b1$col_hashes, b2$col_hashes)) == 0)
- expect_true(length(intersect(b$col_hashes, b1$col_hashes)) == 0)
- expect_true(length(intersect(b$col_hashes, b2$col_hashes)) == 0)
+ expect_length(intersect(b1$col_hashes, b2$col_hashes), 0)
+ expect_length(intersect(b$col_hashes, b1$col_hashes), 0)
+ expect_length(intersect(b$col_hashes, b2$col_hashes), 0)
})
diff --git a/tests/testthat/test_Learner.R b/tests/testthat/test_Learner.R
index b3929b7c9..8917f4452 100644
--- a/tests/testthat/test_Learner.R
+++ b/tests/testthat/test_Learner.R
@@ -21,8 +21,8 @@ test_that("Learners are called with invoke / small footprint of call", {
learner$train(task)
call = as.character(learner$model$call)
expect_character(call, min.len = 1L, any.missing = FALSE)
- expect_true(any(grepl("task$formula()", call, fixed = TRUE)))
- expect_true(any(grepl("task$data", call, fixed = TRUE)))
+ expect_match(call, "task$formula()", fixed = TRUE, all = FALSE)
+ expect_match(call, "task$data", fixed = TRUE, all = FALSE)
expect_lt(sum(nchar(call)), 1000)
})
@@ -236,7 +236,7 @@ test_that("empty predict set (#421)", {
learner$train(task, hout$train_set(1))
pred = learner$predict(task, hout$test_set(1))
expect_prediction(pred)
- expect_true(any(grepl("No data to predict on", learner$log$msg)))
+ expect_match(learner$log$msg, "No data to predict on", all = FALSE)
})
test_that("fallback learner is deep cloned (#511)", {
@@ -330,7 +330,7 @@ test_that("validation task's backend is removed", {
task = tsk("mtcars")
task$internal_valid_task = 1:10
learner$train(task)
- expect_true(is.null(learner$state$train_task$internal_valid_task$backend))
+ expect_null(learner$state$train_task$internal_valid_task$backend)
})
test_that("manual $train() stores validation hash and validation ids", {
@@ -348,7 +348,7 @@ test_that("manual $train() stores validation hash and validation ids", {
# nothing is stored for learners that don't do it
l2 = lrn("classif.featureless")
l2$train(task)
- expect_true(is.null(l2$state$internal_valid_task_hash))
+ expect_null(l2$state$internal_valid_task_hash)
})
test_that("error when training a learner that sets valiadte to 'predefined' on a task without a validation task", {
@@ -421,15 +421,15 @@ test_that("internal_valid_task is created correctly", {
task$internal_valid_task = partition(task)$test
learner$train(task)
learner$validate = NULL
- expect_true(is.null(learner$internal_valid_scores))
- expect_true(is.null(learner$task$internal_valid_task))
+ expect_null(learner$internal_valid_scores)
+ expect_null(learner$task$internal_valid_task)
# validate = NULL (but task has none)
learner1 = LearnerClassifTest$new()
task1 = tsk("iris")
learner1$train(task1)
- expect_true(is.null(learner1$internal_valid_scores))
- expect_true(is.null(learner1$task$internal_valid_task))
+ expect_null(learner1$internal_valid_scores)
+ expect_null(learner1$task$internal_valid_task)
# validate = "test"
LearnerClassifTest2 = R6Class("LearnerClassifTest2", inherit = LearnerClassifDebug,
@@ -455,7 +455,7 @@ test_that("internal_valid_task is created correctly", {
resampling = rsmp("holdout")$instantiate(task2)
learner2$expected_valid_ids = resampling$test_set(1)
learner2$expected_train_ids = resampling$train_set(1)
- expect_error(resample(task2, learner2, resampling), regexp = NA)
+ expect_no_error(resample(task2, learner2, resampling))
# ratio works
LearnerClassifTest3 = R6Class("LearnerClassifTest3", inherit = LearnerClassifDebug,
@@ -477,7 +477,7 @@ test_that("internal_valid_task is created correctly", {
learner4 = lrn("classif.debug", validate = 0.2)
task = tsk("iris")
learner4$train(task)
- expect_true(is.null(task$internal_valid_task))
+ expect_null(task$internal_valid_task)
})
test_that("compatability check on validation task", {
@@ -629,3 +629,37 @@ test_that("predict time is cumulative", {
t2 = learner$timings["predict"]
expect_true(t1 > t2)
})
+
+test_that("configure method works", {
+ learner = lrn("classif.rpart")
+
+ expect_learner(learner$configure())
+ expect_learner(learner$configure(.values = list()))
+
+ # set new hyperparameter value
+ learner$configure(cp = 0.1)
+ expect_equal(learner$param_set$values$cp, 0.1)
+
+ # overwrite existing hyperparameter value
+ learner$configure(xval = 10)
+ expect_equal(learner$param_set$values$xval, 10)
+
+ # set field
+ learner$configure(predict_sets = "train")
+ expect_equal(learner$predict_sets, "train")
+
+ # hyperparameter and field
+ learner$configure(minbucket = 2, parallel_predict = TRUE)
+ expect_equal(learner$param_set$values$minbucket, 2)
+ expect_true(learner$parallel_predict)
+
+ # unknown hyperparameter and field
+ expect_error(learner$configure(xvald = 1), "Cannot set argument")
+
+ # use .values
+ learner = lrn("classif.rpart")
+ learner$configure(.values = list(cp = 0.1, xval = 10, predict_sets = "train"))
+ expect_equal(learner$param_set$values$cp, 0.1)
+ expect_equal(learner$param_set$values$xval, 10)
+ expect_equal(learner$predict_sets, "train")
+})
diff --git a/tests/testthat/test_Measure.R b/tests/testthat/test_Measure.R
index cbe69413e..fd27d2c56 100644
--- a/tests/testthat/test_Measure.R
+++ b/tests/testthat/test_Measure.R
@@ -167,7 +167,7 @@ test_that("primary iters are respected", {
jaccard = msr("sim.jaccard")
expect_error(rr1$aggregate(jaccard), "primary_iters")
- expect_error(rr2$aggregate(jaccard), NA)
+ expect_no_error(rr2$aggregate(jaccard))
jaccard$properties = c(jaccard$properties, "primary_iters")
x1 = rr1$aggregate(jaccard)
x2 = rr3$aggregate(jaccard)
@@ -176,7 +176,7 @@ test_that("primary iters are respected", {
test_that("no predict_sets required (#1094)", {
m = msr("internal_valid_score")
- expect_equal(m$predict_sets, NULL)
+ expect_null(m$predict_sets)
rr = resample(tsk("iris"), lrn("classif.debug", validate = 0.3, predict_sets = NULL), rsmp("holdout"))
expect_double(rr$aggregate(m))
expect_warning(rr$aggregate(msr("classif.ce")), "needs predict sets")
diff --git a/tests/testthat/test_Task.R b/tests/testthat/test_Task.R
index 03ba50853..455300b11 100644
--- a/tests/testthat/test_Task.R
+++ b/tests/testthat/test_Task.R
@@ -646,7 +646,7 @@ test_that("internal_valid_task is printed", {
task = tsk("iris")
task$internal_valid_task = c(1:10, 51:60, 101:110)
out = capture_output(print(task))
- expect_true(grepl(pattern = "* Validation Task: (30x5)", fixed = TRUE, x = out))
+ expect_match(out, "* Validation Task: (30x5)", fixed = TRUE)
})
test_that("task hashes during resample", {
diff --git a/tests/testthat/test_as_learner.R b/tests/testthat/test_as_learner.R
index 28b1523e8..3d34685a1 100644
--- a/tests/testthat/test_as_learner.R
+++ b/tests/testthat/test_as_learner.R
@@ -14,10 +14,10 @@ test_that("as_learner conversion", {
test_that("discard_state", {
learner = lrn("classif.rpart")$train(tsk("iris"))
learner2 = as_learner(learner, clone = TRUE, discard_state = TRUE)
- expect_true(is.null(learner2$state))
+ expect_null(learner2$state)
expect_false(is.null(learner$state))
learner3 = lrn("classif.rpart")
as_learner(learner3, clone = FALSE, discard_state = TRUE)
- expect_true(is.null(learner3$state))
+ expect_null(learner3$state)
})
diff --git a/tests/testthat/test_benchmark.R b/tests/testthat/test_benchmark.R
index 2346aa628..d62a4928d 100644
--- a/tests/testthat/test_benchmark.R
+++ b/tests/testthat/test_benchmark.R
@@ -367,16 +367,16 @@ test_that("benchmark_grid works if paired = TRUE", {
# design[, identical(task), by = task]]
# expect(identical(design$resampling[class(learner)[[1]] ==)]))
expect_true(nrow(design) == 4L) #
- expect_true(identical(design$task[[1]], design$task[[2]]))
- expect_true(identical(design$task[[3]], design$task[[4]]))
+ expect_identical(design$task[[1]], design$task[[2]])
+ expect_identical(design$task[[3]], design$task[[4]])
expect_false(identical(design$task[[1]], design$task[[3]]))
- expect_true(identical(design$resampling[[1]], design$resampling[[2]]))
- expect_true(identical(design$resampling[[3]], design$resampling[[4]]))
+ expect_identical(design$resampling[[1]], design$resampling[[2]])
+ expect_identical(design$resampling[[3]], design$resampling[[4]])
expect_false(identical(design$resampling[[1]], design$resampling[[3]]))
- expect_true(identical(design$learner[[1]], design$learner[[3]]))
- expect_true(identical(design$learner[[2]], design$learner[[4]]))
+ expect_identical(design$learner[[1]], design$learner[[3]])
+ expect_identical(design$learner[[2]], design$learner[[4]])
expect_false(identical(design$learner[[2]], design$learner[[3]]))
diff --git a/tests/testthat/test_encapsulate.R b/tests/testthat/test_encapsulate.R
index 4ed4c9674..2ccf7a27b 100644
--- a/tests/testthat/test_encapsulate.R
+++ b/tests/testthat/test_encapsulate.R
@@ -24,7 +24,7 @@ test_that("evaluate / single step", {
expect_data_table(log, nrows = 2L, ncols = 3L, any.missing = FALSE)
expect_factor(log$class)
expect_set_equal(as.character(log$class), c("output", "warning"))
- expect_true(all(grepl("->train()", log$msg, fixed = TRUE)))
+ expect_match(log$msg, "->train()", fixed = TRUE)
expect_true("output" %in% log$class)
expect_true("warning" %in% log$class)
expect_false("error" %in% log$class)
@@ -40,7 +40,7 @@ test_that("evaluate / single step", {
expect_data_table(log, nrows = 2L, ncols = 3L, any.missing = FALSE)
expect_factor(log$class)
expect_equal(as.character(log$class), c("output", "warning"))
- expect_true(all(grepl("->predict()", log$msg, fixed = TRUE)))
+ expect_match(log$msg, "->predict()", fixed = TRUE)
})
test_that("evaluate / resample", {
diff --git a/tests/testthat/test_hashes.R b/tests/testthat/test_hashes.R
index e776742f5..7957f55b5 100644
--- a/tests/testthat/test_hashes.R
+++ b/tests/testthat/test_hashes.R
@@ -8,8 +8,8 @@ expect_hash_changes = function(x) {
expect_false(identical(x$hash, hash_before))
}
x$id = id_before
- expect_true(identical(x$id, id_before))
- expect_true(identical(x$hash, hash_before))
+ expect_identical(x$id, id_before)
+ expect_identical(x$hash, hash_before)
}
test_that("task$hash", {
diff --git a/tests/testthat/test_lgr.R b/tests/testthat/test_lgr.R
index 43f7cd831..1b0a3ba75 100644
--- a/tests/testthat/test_lgr.R
+++ b/tests/testthat/test_lgr.R
@@ -23,6 +23,6 @@ test_that("log to text file", {
lines = readLines(f)
expect_true(any(startsWith(lines, "INFO")))
expect_true(any(startsWith(lines, "DEBUG")))
- expect_true(any(grepl("'iris'", lines, fixed = TRUE)))
- expect_true(any(grepl("'classif.featureless'", lines, fixed = TRUE)))
+ expect_match(lines, "'iris'", fixed = TRUE, all = FALSE)
+ expect_match(lines, "'classif.featureless'", lines, fixed = TRUE, all = FALSE)
})
diff --git a/tests/testthat/test_marshal.R b/tests/testthat/test_marshal.R
index a43a5341b..e6074b036 100644
--- a/tests/testthat/test_marshal.R
+++ b/tests/testthat/test_marshal.R
@@ -56,7 +56,7 @@ test_that("marshal count works for LearnerClassifDebug", {
learner2 = lrn("classif.debug", count_marshaling = FALSE)
learner2$train(task)
- expect_true(is.null(learner2$model$marshal_count))
+ expect_null(learner2$model$marshal_count)
model1 = learner2$model
model2 = learner2$marshal()$unmarshal()$model
expect_equal(model1, model2)
diff --git a/tests/testthat/test_resample.R b/tests/testthat/test_resample.R
index 7dee66823..5668734a9 100644
--- a/tests/testthat/test_resample.R
+++ b/tests/testthat/test_resample.R
@@ -212,13 +212,13 @@ test_that("marshaling works when store_models is FALSE", {
resample(task, learner, resampling, store_models = FALSE, unmarshal = TRUE)
})
expect_resample_result(rr)
- expect_true(is.null(rr$learners[[1]]$model))
+ expect_null(rr$learners[[1]]$model)
rr1 = with_future(future::sequential, {
resample(task, learner, resampling, store_models = FALSE, unmarshal = TRUE)
})
expect_resample_result(rr1)
- expect_true(is.null(rr1$learners[[1]]$model))
+ expect_null(rr1$learners[[1]]$model)
})
diff --git a/tests/testthat/test_warn_deprecated.R b/tests/testthat/test_warn_deprecated.R
index e848c1979..1f52a78ad 100644
--- a/tests/testthat/test_warn_deprecated.R
+++ b/tests/testthat/test_warn_deprecated.R
@@ -4,10 +4,10 @@ test_that("warn_deprecated works as expected", {
oldopts = options(mlr3.warn_deprecated = TRUE)
expect_warning(warn_deprecated("test"), "^test is deprecated and will be removed in the future\\.$")
- expect_warning(warn_deprecated("test"), NA) # no second warning
+ expect_no_warning(warn_deprecated("test")) # no second warning
oldopts = options(mlr3.warn_deprecated = FALSE)
- expect_warning(warn_deprecated("test2"), NA) # no warning when options disallow it
+ expect_no_warning(warn_deprecated("test2")) # no warning when options disallow it
options(oldopts)
})
@@ -24,11 +24,11 @@ test_that("deprecated_binding works as expected", {
mco = MyClass$new()
expect_warning({fooval = mco$foo}, "^MyClass\\$foo is deprecated and will be removed in the future\\.$")
expect_equal(fooval, "bar")
- expect_warning({fooval = mco$foo}, NA) # no second warning
+ expect_no_warning({fooval = mco$foo}) # no second warning
expect_equal(fooval, "bar")
oldopts = options(mlr3.warn_deprecated = FALSE)
- expect_warning({foo2val = mco$foo2}, NA) # no warning when options disallow it
+ expect_no_warning({foo2val = mco$foo2}) # no warning when options disallow it
expect_equal(foo2val, 1)
mco$val = 2
expect_equal(mco$foo2, 2)