From 1494d4ad12a5bab2f89282b1bc94aa651ca85143 Mon Sep 17 00:00:00 2001 From: advieser Date: Fri, 28 Feb 2025 19:36:35 +0100 Subject: [PATCH] add preliminary test --- tests/testthat/test_pipeop_adas.R | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/testthat/test_pipeop_adas.R b/tests/testthat/test_pipeop_adas.R index 9c8786565..c02e5299d 100644 --- a/tests/testthat/test_pipeop_adas.R +++ b/tests/testthat/test_pipeop_adas.R @@ -79,3 +79,14 @@ test_that("PipeOpADAS - handling of feature named 'class'", { expect_equal(train_out, adas_out) }) + +test_that("PipeOpADAS - handles unseen levels in target, #881", { + skip_if_not_installed("smotefamily") + op = PipeOpADAS$new() + task = tsk("iris")$filter(1:99) + train_out = op$train(list(task))[[1L]] + expect_equal(task$levels(), train_out$levels()) +}) +# This fails with 1:100 because sum(knct[, 2]) is 0 since all entries are 0 ... +# is the case because both classes occur the same number of times +# probably want to catch this as well?