tests/testthat/test-bsmote_impl.R

circle_example_num <- circle_example[, c("x", "y", "class")]

test_that("bsmote() interfaces correctly", {
  expect_error(bsmote(circle_example_num, var = "class"), NA)

  expect_snapshot(error = TRUE,
    bsmote(circle_example_num, var = "Class")
  )

  expect_snapshot(error = TRUE,
    bsmote(circle_example_num, var = c("class", "x"))
  )

  expect_snapshot(error = TRUE,
    bsmote(circle_example_num, var = "x")
  )

  circle_example0 <- circle_example_num
  circle_example0[1, 1] <- NA

  expect_snapshot(error = TRUE,
    bsmote(circle_example0, var = "class")
  )

  expect_snapshot(error = TRUE,
    bsmote(circle_example_num, var = "class", k = 0)
  )

  expect_snapshot(error = TRUE,
    bsmote(circle_example_num, var = "class", k = -1)
  )

  expect_snapshot(error = TRUE,
    bsmote(circle_example_num, var = "class", k = c(5, 10))
  )
})

Try the themis package in your browser

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

themis documentation built on Aug. 15, 2023, 1:05 a.m.