tests/testthat/test_models.utility.GenericModelFit.R

testthat::test_that("GenericModelFit: initialize function works", {

  instances <- data.frame(c(1, 2), c(2, 2))

  colnames(instances) <- c("C1", "Class")

  testthat::expect_is(GenericModelFit$new(), "GenericModelFit")

})

testthat::test_that("GenericModelFit: createFormula function works", {

  instances <- data.frame(c(1, 2), c(2, 2))

  colnames(instances) <- c("C1", "Class")

  testthat::expect_error(GenericModelFit$new()$createFormula(instances = instances,
                                                             class.name = "Class"),
                         "[GenericModelFit][FATAL] Class is abstract. Method should be defined in inherited class. Aborting...",
                         fixed = TRUE)
})

testthat::test_that("GenericModelFit: createRecipe function works", {

  instances <- data.frame(c(1, 2), c(2, 2))

  colnames(instances) <- c("C1", "Class")

  testthat::expect_error(GenericModelFit$new()$createRecipe(instances = instances,
                                                            class.name = "Class"),
                         "[GenericModelFit][FATAL] Class is abstract. Method should be defined in inherited class. Aborting...",
                         fixed = TRUE)
})

Try the D2MCS package in your browser

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

D2MCS documentation built on Aug. 23, 2022, 5:07 p.m.