You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I've just stumbled upon an issue I can't diagnose. testthat::expect_equal unexpectedly returns "Error: act (actual) not equal to exp (expected). actual != expected but don't know how to show the difference", for some tolerance values, and displays errors in another format for other tolerance values. Below .14 of tolerance I get an error, and below .0098 I get a correctly displayed error.
Here is a MWE:
act<- c(1.728489e-05, 1.728662e-01, 2.230096e-01)
exp<- c(1.020453e-06, 1.694780e-01, 2.211992e-01)
testthat::expect_equal(
object=act,
expected=exp,
tolerance=.01
)
# Error: `act` (`actual`) not equal to `exp` (`expected`).# actual != expected but don't know how to show the differencetestthat::expect_equal(
object=act,
expected=exp,
tolerance=.014
)
# no errortestthat::expect_equal(
object=act,
expected=exp,
tolerance=.0098
)
# Error: `act` (`actual`) not equal to `exp` (`expected`).# `actual`: 0.000 0.173 0.223#`expected`: 0.000 0.169 0.221
Is it due to a switch between relative vs absolute tolerance mentioned in the docs?
I would have expected to have the same error report for any too strict tolerance, and the first error is not informative.
Ok this actually seems to be a waldo related issue:
waldo::compare(
act,
exp,
tolerance=.01)
# old != new but don't know how to show the differencewaldo::compare(
act,
exp,
tolerance=.014)
# ✔ No differenceswaldo::compare(
act,
exp,
tolerance=.0098)
# `old`: 0.000 0.173 0.223# `new`: 0.000 0.169 0.221
A similar is open there, see r-lib/waldo#190. On a not too dissimilar theme I think r-lib/waldo#188 is also an issue for using testthat reliably.
I leave this issue open hoping it will help the ones open on waldo's repo being picked up.
Hi,
I've just stumbled upon an issue I can't diagnose.
testthat::expect_equal
unexpectedly returns "Error:act
(actual
) not equal toexp
(expected
). actual != expected but don't know how to show the difference", for some tolerance values, and displays errors in another format for other tolerance values. Below .14 of tolerance I get an error, and below .0098 I get a correctly displayed error.Here is a MWE:
Is it due to a switch between relative vs absolute tolerance mentioned in the docs?
I would have expected to have the same error report for any too strict tolerance, and the first error is not informative.
Thanks for your help and this great package!
The text was updated successfully, but these errors were encountered: