Require usage of expect_identical(x, y) where appropriateSource:
testthat::expect_identical() should be the default/go-to function for
comparing an output to an expected value.
is an equivalent but unadvised method of the same test. Further,
testthat::expect_equal() should only be used when
is inappropriate, i.e., when
y need only be numerically
equivalent instead of fully identical (in which case, provide the
tolerance= argument to
expect_equal() explicitly). This also applies
when it's inconvenient to check full equality (e.g., names can be ignored,
in which case
ignore_attr = "names" should be supplied to
expect_equal() (or, for 2nd edition,
check.attributes = FALSE).
The linter allows
expect_equal() in three circumstances:
A named argument is set (e.g.
Comparison is made to an explicit decimal, e.g.
expect_equal(x, 1.0)(implicitly setting
...is passed (wrapper functions whcih might set arguments such as
linters for a complete list of linters available in lintr.