Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bblodfon committed Feb 7, 2025
1 parent 3f9da4b commit dac498f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions tests/testthat/test_TaskClassif.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ test_that("offset column role works with binary tasks", {

task$set_col_roles("age", "offset")
expect_subset("offset", task$properties)
expect_data_table(task$offset, nrows = task$nrow, ncols = 1)
expect_data_table(task$offset, nrows = task$nrow, ncols = 2)
expect_subset("age", names(task$offset))

expect_error({
Expand All @@ -138,8 +138,8 @@ test_that("offset column role works with multiclass tasks", {
expect_null(task$offset)
task$set_col_roles("year", "offset")
expect_subset("offset", task$properties)
expect_data_table(task$offset, nrows = task$nrow, ncols = 1)
expect_subset("year", names(task$offset))
expect_data_table(task$offset, nrows = task$nrow, ncols = 2)
expect_subset(c("row_id", "year"), names(task$offset))

expect_error({
task$col_roles$offset = "bill_length"
Expand All @@ -159,6 +159,6 @@ test_that("offset column role works with multiclass tasks", {
task$set_col_roles(c("offset_1", "offset_2"), "offset")

expect_subset("offset", task$properties)
expect_data_table(task$offset, nrows = task$nrow, ncols = 2)
expect_subset(c("offset_1", "offset_2"), names(task$offset))
expect_data_table(task$offset, nrows = task$nrow, ncols = 3)
expect_subset(c("row_id", "offset_1", "offset_2"), names(task$offset))
})
4 changes: 2 additions & 2 deletions tests/testthat/test_TaskRegr.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ test_that("offset column role works", {
task$set_col_roles("am", "offset")

expect_subset("offset", task$properties)
expect_data_table(task$offset, nrows = task$nrow, ncols = 1)
expect_subset("am", names(task$offset))
expect_data_table(task$offset, nrows = task$nrow, ncols = 2)
expect_subset(c("row_id", "am"), names(task$offset))

expect_error({
task$col_roles$offset = c("am", "gear")
Expand Down

0 comments on commit dac498f

Please sign in to comment.