From 6c69e34dac3edd0e7f75eef39eb878e48f165a38 Mon Sep 17 00:00:00 2001 From: kenomersmannPC Date: Mon, 9 Dec 2024 21:42:03 +0100 Subject: [PATCH] slight change in tests --- tests/testthat/test_pipeop_colroles.R | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/testthat/test_pipeop_colroles.R b/tests/testthat/test_pipeop_colroles.R index dac44e2a0..42089bc44 100644 --- a/tests/testthat/test_pipeop_colroles.R +++ b/tests/testthat/test_pipeop_colroles.R @@ -69,13 +69,15 @@ test_that("PipeOpColRoles - new_role works", { task = mlr_tasks$get("iris") task$cbind(data.table(rn = sprintf("%03d", 1:150))) - op = PipeOpColRoles$new(param_vals = list(new_role = list(rn = "name", Petal.Length = "order", Petal.Width = character(0), Sepal.Width = NULL))) + op = PipeOpColRoles$new(param_vals = list(new_role = list( + rn = "name", Petal.Length = c("feature", "order"), Petal.Width = character(0), Sepal.Width = NULL)) + ) train_out = train_pipeop(op, inputs = list(task))[[1L]] col_roles_actual = train_out$col_roles col_roles_expected = list( - feature = "Sepal.Length", target = "Species", name = "rn", order = "Petal.Length", + feature = c("Sepal.Length", "Petal.Length"), target = "Species", name = "rn", order = "Petal.Length", stratum = character(0), group = character(0), weight = character(0) ) @@ -98,13 +100,14 @@ test_that("PipeOpColRoles - new_role_direct works", { task$col_roles$group = "Species" op = PipeOpColRoles$new(param_vals = list(new_role_direct = list( - name = "rn", order = "Petal.Length", feature = character(0), group = NULL))) + name = "rn", order = c("Petal.Length", "Sepal.Length"), feature = character(0), group = NULL)) + ) train_out = train_pipeop(op, inputs = list(task))[[1L]] col_roles_actual = train_out$col_roles col_roles_expected = list( - feature = character(0), target = "Species", name = "rn", order = "Petal.Length", + feature = character(0), target = "Species", name = "rn", order = c("Petal.Length", "Sepal.Length"), stratum = character(0), group = character(0), weight = character(0) ) @@ -118,3 +121,4 @@ test_that("PipeOpColRoles - new_role_direct works", { predict_out = predict_pipeop(op, inputs = list(task))[[1L]] expect_equal(train_out, predict_out) }) +