-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
@test a ≈ b atol=ε
#19901
@test a ≈ b atol=ε
#19901
Conversation
c260a04
to
535c0cd
Compare
|
||
The `@test f(args...) key=val...` form is equivalent to writing | ||
`@test f(args..., key=val...)` which can be useful when the expression | ||
does is a call using infix syntax such as approximate comparisons: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does or is, not both
9530ca1
to
205ed30
Compare
@test a ≈ b atol=ε
mean @test ≈(a, b, atol=ε)
@test a ≈ b atol=ε
739035e
to
29ff301
Compare
# nothing. | ||
isdefined(:test_approx_eq_modphase) || | ||
function test_approx_eq_modphase{S<:Real,T<:Real}( | ||
a::StridedVecOrMat{S}, b::StridedVecOrMat{T}, err=nothing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than copy-and-paste this into two files, can you just put it in a separate file and include
it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few packages are calling this, so better to deprecate it
Does this work with |
We don't currently call |
@test a ≈ b atol=ε | ||
|
||
This is equivalent to the uglier test `@test ≈(a, b, atol=ε)`. | ||
It is an error or supply more than one expression unless the first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"an error to supply"
@@ -912,6 +953,8 @@ end | |||
#----------------------------------------------------------------------- | |||
# Legacy approximate testing functions, yet to be included | |||
|
|||
# BEGIN TODO: deprecated in 0.6, delete in 1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be a major pain to deal with deprecations if they were all done this way. please don't encourage this, move the code to deprecated.jl with an eval into the right module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otoh, it would avoid a ton of conflicts in base/deprecated.jl
.
In light of #19936, this becomes even more useful. Going to make some improvements and then merge this once CI passes. |
with the deprecations in the right place, please |
yeah, yeah |
Makes it simple to search-and-replace calls to this macro.
Potential syntax for #19899.
Note that tolerance of the first Anscombe's quartet test in test/linalg/generic.jl had to be loosened from 10e-5 to 15e-5 because ≈ uses the norm of the difference instead of the maximum absolute difference, which is a stricter test. Closes #19899.
eee4765
to
2ece635
Compare
2ece635
to
83bf2db
Compare
AppVeyor failure is the intermittent Pkg test thing, unrelated. |
I'll leave this for review a while longer, but as far as I'm concerned, this is good to merge. |
in order to not change what module the deprecations are in, should eval them into Base.Test |
FFS. That's why I didn't move them in the first place. Evaling them into Base is so much uglier. |
less ugly than having them scattered all over the place. ugliness in deprecated.jl isn't much of a problem |
Well, I'm going to merge this and you can fix it because I'm getting on a plane in the morning and can't do anything for a good while. |
It shouldn't be on master if it's broken. Would have rather fixed it here.
|
Fixes deprecation due to JuliaLang/julia#19901.
Unfortunately, this doesn't work with chained comparisons: julia> @test x ≈ y ≈ z atol=0.1
ERROR: LoadError: invalid test macro call: @test x ≈ y ≈ z atol = 0.1
Stacktrace:
[1] error at ./error.jl:33 [inlined]
[2] test_expr!(::String, ::Expr, ::Expr, ::Vararg{Expr,N} where N) at /Users/stevenj/Documents/Code/julia/usr/share/julia/site/v0.7/Test/src/Test.jl:278
[3] @test(::LineNumberNode, ::Module, ::Any, ::Vararg{Any,N} where N) at /Users/stevenj/Documents/Code/julia/usr/share/julia/site/v0.7/Test/src/Test.jl:301
in expression starting at REPL[5]:1 Just ran into this in #24159. |
Potential syntax for #19899.