tests/testthat/test_stack_metrics_and_plot.R

test_that("test stack metric and plot", {
  sm <- stack_metrics(fobject)
  df <- expand_fairness_object(fobject)
  df$score <- round(df$score, 3)


  expect_equal(
    sm$stacked_data[sm$stacked_data$metric == "TPR" & sm$stacked_data$model == "lm", "score"],
    df[df$metric == "TPR" & df$model == "lm", "score"]
  )


  plt <- plot(sm)

  expect_s3_class(plt, "ggplot")

  expect_equal(plt$labels$title, "Stacked Metric plot")
})

Try the fairmodels package in your browser

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

fairmodels documentation built on Oct. 8, 2021, 5:06 p.m.