-
-
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
Fix @test isapprox(...)
when using keywords
#22558
Conversation
The introduction of showing evaluated expressions for calls in #22296 only dealt with parsing function arguments without considering keyword arguments. Mostly this oversight was due to the functionality being added just for `isequal` call and `isapprox` was afterthought.
test/test.jl
Outdated
@@ -122,6 +125,14 @@ str = sprint(show, fails[8]) | |||
@test contains(str, "Evaluated: isapprox(0.0, -Inf)") | |||
|
|||
str = sprint(show, fails[9]) | |||
@test contains(str, "Expression: isapprox(1 / 2, 2 / 1, atol=1 / 1)") | |||
@test contains(str, "Evaluated: isapprox(0.5, 2.0; atol=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.
Note that the evaluated expression currently will always display a ;
when keywords are used.
cc: @nalimilan |
Worth adding passing tests like @test isapprox(1, 1, atol=0.1)
@test isapprox(1, 1; atol=0.1) too? If a failing test throws instead of properly reporting the failure, that is unfortunate. If a test that would otherwise pass makes the test system throw, that's much worse, isn't it? |
Good idea to add in some passing tests. |
It would be great to have this merged soon. Many Travis tests are failing because of the issue. |
I should be wrapping this up shortly. I was also correcting #22296 (comment) which looks like it is working now. |
base/test.jl
Outdated
|
||
for a in args | ||
# Keywords that occur before `;`. Note that the keywords are being revised into | ||
# a we can splat. |
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 form ?
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.
Thanks
test/test.jl
Outdated
@@ -156,6 +157,11 @@ str = sprint(show, fails[14]) | |||
@test contains(str, "Unexpected Pass") | |||
@test contains(str, "Expression: true") | |||
|
|||
str = sprint(show, fails[15]) | |||
@test contains(str, "Expression: ==(1, 2:3...)") | |||
@test contains(str, "MethodError: no method matching ==(::Int64, ::Int64, ::Int64)") |
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.
will probably need to be $Int
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.
You are correct
f856b1e
to
edb6cfd
Compare
I'll try to merge when/if the CI is successful. |
edb6cfd
to
4bc2ab8
Compare
I'll add some additional tests in another PR. I'll merge this to get package CIs working again. |
The introduction of showing evaluated expressions for calls in #22296 only dealt with parsing function arguments without considering keyword arguments. Mostly this oversight was due to the functionality being added just for
isequal
call andisapprox
was afterthought.Addresses #22296 (comment)