Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
be-marc committed Dec 20, 2024
1 parent 9df4b85 commit 391be36
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/testthat/test_Learner.R
Original file line number Diff line number Diff line change
Expand Up @@ -667,10 +667,13 @@ test_that("configure method works", {
test_that("selected_features works", {
task = tsk("spam")
# alter rpart class to not support feature selection
LearnerClassifRpart2 = R6::R6Class("LearnerClassifRpart2", inherit = LearnerClassifRpart)
LearnerClassifRpart2$public_methods$selected_features = NULL
fun = LearnerClassifRpart$public_methods$selected_features
on.exit({
LearnerClassifRpart$public_methods$selected_features = fun
})
LearnerClassifRpart$public_methods$selected_features = NULL

learner = LearnerClassifRpart2$new()
learner = lrn("classif.rpart")
expect_error(learner$selected_features(), "No model stored")
learner$train(task)
expect_error(learner$selected_features(), "Learner does not support feature selection")
Expand Down

0 comments on commit 391be36

Please sign in to comment.