Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
be-marc committed Nov 4, 2024
1 parent 44b6aee commit 921703d
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions tests/testthat/test_Task.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
test_that("Feature columns can be reordered", {
ah = readRDS(system.file("extdata", "ames_housing.rds", package = "mlr3"))

task = tsk("ames_housing")
task$set_col_roles(setdiff(names(ah), "Sale_Price"), "feature")

expect_equal(task$feature_names, setdiff(names(ah), "Sale_Price"))
expect_equal(names(task$data(rows = 1)), c("Sale_Price", setdiff(names(ah), "Sale_Price")))
new_order = shuffle(task$feature_names)

task$set_col_roles(shuffle(task$col_roles$feature), "feature")
expect_equal(names(task$data(rows = 1)), c("Sale_Price", task$col_roles$feature))
task$col_roles$feature = new_order
expect_equal(task$feature_names, new_order)
expect_equal(names(task$data(rows = 1)), c("Sale_Price", new_order))
})

test_that("Task duplicates rows", {
Expand Down

0 comments on commit 921703d

Please sign in to comment.