Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace expect_equal() with expect_identical() in tests where possible #268

Closed
peterdesmet opened this issue Dec 9, 2022 · 0 comments · Fixed by #276 or #274
Closed

Replace expect_equal() with expect_identical() in tests where possible #268

peterdesmet opened this issue Dec 9, 2022 · 0 comments · Fixed by #276 or #274
Assignees
Labels
actionable Can be implemented

Comments

@peterdesmet
Copy link
Member

peterdesmet commented Dec 9, 2022

Note from Pieter:

reference: https://testthat.r-lib.org/reference/equality-expectations.html

These functions provide two levels of strictness when comparing a computation to a reference value. expect_identical() is the baseline; expect_equal() relaxes the test to ignore small numeric differences.

In the 3rd edition, both functions use waldo. They differ only in that expect_equal() sets tolerance = testthat_tolerance() so that small floating point differences are ignored; this also implies that (e.g.) 1 and 1L are treated as equal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
actionable Can be implemented
Projects
None yet
2 participants