Skip to content

Commit 541c478

Browse files
authored
tests: remove loading of mlr3pipelines (#471)
* ... * ...
1 parent b21a0ad commit 541c478

File tree

5 files changed

+9
-15
lines changed

5 files changed

+9
-15
lines changed

inst/testthat/helper_misc.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,13 @@ LearnerRegrDepParams = R6Class("LearnerRegrDepParams", inherit = LearnerRegr,
131131
)
132132

133133
MAKE_GL = function() {
134-
g = Graph$new()
135-
op_ds = PipeOpSubsample$new()
136-
op_lrn = PipeOpLearner$new(lrn("classif.rpart"))
134+
g = mlr3pipelines::Graph$new()
135+
op_ds = mlr3pipelines::PipeOpSubsample$new()
136+
op_lrn = mlr3pipelines::PipeOpLearner$new(lrn("classif.rpart"))
137137
g$add_pipeop(op_ds)
138138
g$add_pipeop(op_lrn)
139139
g$add_edge("subsample", "classif.rpart")
140-
GraphLearner$new(g)
140+
mlr3pipelines::GraphLearner$new(g)
141141
}
142142

143143
flush_redis = function() {

tests/testthat/helper.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
library(mlr3)
22
library(checkmate)
33
library(mlr3misc)
4-
library(mlr3pipelines)
54
library(paradox)
65
library(R6)
76

tests/testthat/test_AutoTuner.R

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ test_that("AT training does not change learner in instance args", {
9797
test_that("AutoTuner works with graphlearner", {
9898
skip_if_not_installed("mlr3pipelines")
9999
skip_if(packageVersion("mlr3pipelines") < "0.5.3")
100-
requireNamespace("mlr3pipelines")
101100

102101
gl = MAKE_GL()
103102
task = tsk("iris")
@@ -134,7 +133,6 @@ test_that("AutoTuner works with graphlearner", {
134133

135134
test_that("Nested resampling works with graphlearner", {
136135
skip_if_not_installed("mlr3pipelines", "0.5.3")
137-
requireNamespace("mlr3pipelines")
138136

139137
gl = MAKE_GL()
140138
task = tsk("iris")
@@ -275,7 +273,7 @@ test_that("search space from TuneToken works", {
275273

276274
test_that("AutoTuner get_base_learner method works", {
277275
skip_if_not_installed("mlr3pipelines", "0.5.3")
278-
requireNamespace("mlr3pipelines")
276+
`%>>%` = mlr3pipelines::`%>>%`
279277

280278
# simple learner
281279
learner = lrn("classif.rpart", cp = to_tune(1e-04, 1e-1, logscale = TRUE))
@@ -293,7 +291,7 @@ test_that("AutoTuner get_base_learner method works", {
293291
expect_equal(at$base_learner(recursive = 0)$id, "classif.rpart")
294292

295293
# graph learner
296-
learner = as_learner(pipeline_robustify() %>>% lrn("classif.rpart"))
294+
learner = as_learner(mlr3pipelines::pipeline_robustify() %>>% lrn("classif.rpart"))
297295
learner$param_set$values$classif.rpart.cp = to_tune(1e-04, 1e-1, logscale = TRUE)
298296
learner$id = "graphlearner.classif.rpart"
299297

tests/testthat/test_Tuner.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ test_that("print method workds", {
7070

7171
test_that("Tuner works with graphlearner", {
7272
skip_if_not_installed("mlr3pipelines")
73-
requireNamespace("mlr3pipelines")
7473

7574
gl = MAKE_GL()
7675
task = tsk("iris")
@@ -410,6 +409,7 @@ test_that("tag internal tune token manually in primary search space", {
410409

411410
test_that("Can only pass internal tune tokens one way", {
412411
skip_if_not_installed("mlr3pipelines")
412+
413413
l1 = lrn("classif.debug", early_stopping = TRUE)
414414
l1$id = "l1"
415415
l2 = l1$clone()
@@ -418,7 +418,7 @@ test_that("Can only pass internal tune tokens one way", {
418418
l1$param_set$set_values(
419419
iter = to_tune(upper = 100, internal = TRUE)
420420
)
421-
l = ppl("branch", list(l1 = l1, l2 = l2))
421+
l = mlr3pipelines::ppl("branch", list(l1 = l1, l2 = l2))
422422
l = as_learner(l)
423423
set_validate(l, 0.2, ids = c("l1", "l2"))
424424

tests/testthat/test_TuningInstanceBatchSingleCrit.R

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,7 @@ test_that("tuning with custom resampling", {
109109

110110
test_that("non-scalar hyperpars (#201)", {
111111
skip_if_not_installed("mlr3pipelines")
112-
113-
requireNamespace("mlr3pipelines")
114-
`%>>%` = getFromNamespace("%>>%", asNamespace("mlr3pipelines"))
115-
112+
`%>>%` = mlr3pipelines::`%>>%`
116113

117114
learner = mlr3pipelines::po("select") %>>% lrn("classif.rpart")
118115

0 commit comments

Comments
 (0)