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
It would be nice to have a more informative failure message for a @test x ≈ y that:
If one of the operands iszero, and the caller didn't pass a explicit atol, warn them that they might want to specify an atol (or rewrite e.g. x - y ≈ 0 to x ≈ y), and direct them to the isapprox docs.
I think the first point here is a new one, otherwise: #55613
Anyway, how should one implement it without duplicating the logic of isapprox? Or how to avoid making PkgTest depend on LinearAlgebra for norm of vectors?
I think you have to duplicate some of the logic. Fortunately that logic is very simple.
Yes, that would make Test (not Pkg) explicitly depend on LinearAlgebra, but I don't see that as a big deal. LinearAlgebra is already implicitly loaded inside Julia, and is used when you callisapprox whether or not you explicitly depend on it.
(Or we could add a Base.isapprox_showerror(io, x, y; kws...) function, and then add additional methods in LinearAlgebra for arrays, then call this from Test. This would have the advantage of being easier to extend for more types. It would still involve some duplicated logic, though.)
It would be nice to have a more informative failure message for a
@test x ≈ y
that:iszero
, and the caller didn't pass a explicitatol
, warn them that they might want to specify anatol
(or rewrite e.g.x - y ≈ 0
tox ≈ y
), and direct them to theisapprox
docs.rtol
) check, print out the computed relative errornorm(x - y) / max(norm(x), norm(y))
. See also report error magnitude on @test x ≈ y failure #55613(I feel like this has been raised before, but I can't find an issue?)The text was updated successfully, but these errors were encountered: