tests/testthat/test-att_definition.R

test_that("att_definition", {
  wd <- when()

  f <- wd |>
    get_attribute_definition_function(name = "year")

  g <- function(table, values, ...) {
    table[['year']] <- '2025'
    table
  }

  wd <- wd |>
    set_attribute_definition_function(name = "year", g)

  h <- wd |>
    get_attribute_definition_function(name = "year")

  t <- wd |>
    generate_table() |>
    get_table()


  expect_equal(g, h)

  expect_equal(t[['year']], "2025")

})

Try the when package in your browser

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

when documentation built on May 29, 2024, 5:01 a.m.