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

Show evaluated test arguments for set/char/numeric comparison functions #57820

Closed
wants to merge 6 commits into from

Conversation

omus
Copy link
Member

@omus omus commented Mar 18, 2025

Extends the list of functions introduced in #30721 which show their evaluated arguments when the @test fails. Having this makes it much easier at a glance to debug the problem:

julia> using Test

julia> x = [1,2];

julia> y = [1,3];

julia> @test issubset(x, y)
Test Failed at REPL[5]:1
  Expression: issubset(x, y)
   Evaluated: issubset([1, 2], [1, 3])

ERROR: There was an error during testing

The original PR added some good tests for this functionality. The new functions are less complicated than isapprox so I was thinking additional tests wouldn't be required. I can add some if others feel differently.

Alternative to:

@omus
Copy link
Member Author

omus commented Mar 18, 2025

I'm considering expanding this functionality further to evaluated arguments for any 1/2 argument function call.

@omus omus changed the title Show evaluated output for set/char/numeric comparison functions Show evaluated test arguments for set/char/numeric comparison functions Mar 18, 2025
Copy link
Member

@LilithHafner LilithHafner left a comment

Choose a reason for hiding this comment

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

Most of these are clear improvements and an easy merge. The issetequal and issubset functions are a bit iffy because they might be come less readable in the case of large objects:

julia> using Test

julia> x = rand(10000);

julia> @test issubset(x[1:100], x)
Test Passed

julia> @test issubset(x, x[1:100])
Test Failed at REPL[4]:1
  Expression: issubset(x, x[1:100])

TBH I'm fine with including them if you want, regardless.

@omus
Copy link
Member Author

omus commented Mar 19, 2025

The issetequal and issubset functions are a bit iffy because they might be come less readable in the case of large objects

True, however we can already see the evaluate output for issubset by using the operator instead:

julia> using Test

julia> x = rand(10000);

julia> @test Set(x)  Set(x[1:100])
Test Failed at REPL[4]:1
  Expression: Set(x)  Set(x[1:100])
   Evaluated: Set([0.610825218143219, 0.07609558482085998, 0.6472379469621696, 0.2866250518445128, 0.9894449007594035, 0.5896579008491469, 0.43901414917292614, 0.17669143107161656, 0.6027709720821334, 0.7507150294850947    0.6401123629705973, 0.8328115919098275, 0.8655849484323953, 0.04856521127506497, 0.6974018123218493, 0.15446669145578185, 0.022489484375737723, 0.7115874557949187, 0.9301378413142882, 0.20743897739462058])  Set([0.08236731303653522, 0.013527805966567885, 0.3587710294990768, 0.33806174679565326, 0.13010121886943615, 0.7132695337183813, 0.5612640721162494, 0.42069056143135375, 0.46486952878111376, 0.6824664276902744    0.6985310136900829, 0.009170975815409044, 0.18339254712771613, 0.6401123629705973, 0.7236067219720211, 0.6782758185089984, 0.5871499370719643, 0.4262745626946086, 0.022489484375737723, 0.6150820937170625])

ERROR: There was an error during testing

@omus
Copy link
Member Author

omus commented Mar 19, 2025

I'm going to see if we can move forward with #57825 first. We can hold off on merging this for now

@omus
Copy link
Member Author

omus commented Mar 20, 2025

Closing in favor of #57825

@omus omus closed this Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants