tests/testthat/test-flatten.R

test_that("flat tables", {
  lst <- data_three_class()
  three_class <- lst$three_class
  three_class_tb <- lst$three_class_tb

  expect_identical(
    unname(yardstick:::flatten(three_class_tb)),
    as.vector(three_class_tb)
  )
  expect_equal(
    names(yardstick:::flatten(three_class_tb[1:2, 1:2])),
    c("cell_1_1", "cell_2_1", "cell_1_2", "cell_2_2")
  )

  expect_snapshot(
    error = TRUE,
    yardstick:::flatten(three_class_tb[, 1:2])
  )
})

Try the yardstick package in your browser

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

yardstick documentation built on June 22, 2024, 7:07 p.m.