tests/testthat/test_tf.R

test_that("tf does not support NAs", {
  # Various PipeOps assume that there are no functional NAs
  # This test will inform us whether this feature is implemented,
  # in which case we then have to adress this case in the PipeOps
  # https://github.com/tidyfun/tf/issues/33
  # Currently, NA functions are dropped
  d = data.frame(time = 1, value = NA_real_, id = "1", stringsAsFactors = FALSE)
  x = invisible(tf::tfd(d, arg = "time", value = "value", id = "id"))
  expect_length(x, 0L)
})

test_that("pofu has no surprises: irreg", {
  # pofu can successfully determine that the two cca columns are identical
  task = tsk("dti")$select("cca")
  task1 = task$clone(deep = TRUE)
  task1$id = "test"
  taskout = po("featureunion")$train(list(task, task1))[[1L]]
  expect_permutation(taskout$feature_names, "cca")
})

test_that("pofu has no surprises: reg", {
  # pofu can successfully determine that the two cca columns are identical
  task = tsk("fuel")$select("NIR")
  task1 = task$clone(deep = TRUE)
  task1$id = "test"
  taskout = po("featureunion")$train(list(task, task1))[[1L]]
  expect_permutation(taskout$feature_names, "NIR")
})

Try the mlr3fda package in your browser

Any scripts or data that you put into this service are public.

mlr3fda documentation built on Sept. 12, 2024, 7:19 a.m.