[Soft-deprecated]

These functions are deprecated.

expect_func(var, ...)

expect_join(data2, by = NULL, not = FALSE, flt = TRUE, data = get_testdata())

expect_similar(
  var,
  data2,
  var2,
  flt = TRUE,
  flt2 = flt,
  threshold = 0.05,
  min = 100,
  data = get_testdata()
)

expect_allany(
  vars,
  func,
  flt = TRUE,
  data = get_testdata(),
  args = list(),
  allany = c(chk_filter_all, chk_filter_any),
  func_desc = NULL
)

Arguments

var

An unquoted column name to test.

...

Arguments to pass to expect_allany().

data2

The data frame to compare against.

by

A character vector of columns to join by. See dplyr::join() for details.

not

Reverse the results of the check?

flt

<data-masking> A filter specifying a subset of the data frame to test.

data

A data frame to test. The global test data is used by default.

var2

An unquoted column name from data2.

flt2

A filter specifying a subset of data2 to test.

threshold

The maximum proportional difference allowed between the two categories.

min

The minimum number of responses for a category to allow comparison. This avoids small categories raising spurious errors.

vars

<tidy-select> A set of columns to test.

func

A function to use for testing that takes a vector as the first argument and returns a logical vector of the same length showing whether an element passed or failed.

args

A named list of arguments to pass to func.

allany

The function to combine the func results for each row.

func_desc

A human friendly description of func to use in the expectation failure message.

Value

expect_*() functions are mainly called for their side effects. The expectation signals its result (e.g. "success", "failure"), which is logged by the current test reporter. In a non-testing context the expectation will raise an error with class expectation_failure if it fails.