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

Fix @test isapprox(...) when using keywords #22558

Merged
merged 3 commits into from
Jun 29, 2017
Merged

Conversation

omus
Copy link
Member

@omus omus commented Jun 26, 2017

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.

Addresses #22296 (comment)

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.
@omus omus added bugfix This change fixes an existing bug display and printing Aesthetics and correctness of printed representations of objects. testsystem The unit testing framework and Test stdlib labels Jun 26, 2017
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)")
Copy link
Member Author

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.

@omus
Copy link
Member Author

omus commented Jun 26, 2017

cc: @nalimilan

@martinholters
Copy link
Member

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?

@omus
Copy link
Member Author

omus commented Jun 27, 2017

Good idea to add in some passing tests.

@andreasnoack
Copy link
Member

It would be great to have this merged soon. Many Travis tests are failing because of the issue.

@omus
Copy link
Member Author

omus commented Jun 28, 2017

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a form ?

Copy link
Member Author

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)")
Copy link
Contributor

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct

@omus omus force-pushed the cv/test-results-isequal-fix branch from f856b1e to edb6cfd Compare June 28, 2017 20:12
@omus
Copy link
Member Author

omus commented Jun 28, 2017

I'll try to merge when/if the CI is successful.

@omus omus force-pushed the cv/test-results-isequal-fix branch from edb6cfd to 4bc2ab8 Compare June 28, 2017 20:45
@omus
Copy link
Member Author

omus commented Jun 29, 2017

I'll add some additional tests in another PR. I'll merge this to get package CIs working again.

@omus omus merged commit 82df8e7 into master Jun 29, 2017
@tkelman tkelman deleted the cv/test-results-isequal-fix branch June 29, 2017 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This change fixes an existing bug display and printing Aesthetics and correctness of printed representations of objects. testsystem The unit testing framework and Test stdlib
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants