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

Better assertion in Python utils #3149

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

JCGoran
Copy link
Collaborator

@JCGoran JCGoran commented Oct 29, 2024

It's a bit challenging to debug any potential failures in the Python tests if the failure is not asserted at the exact location, so it's better to fail early rather than propagating an error flag further.

Copy link

sonarcloud bot commented Oct 29, 2024

@1uc
Copy link
Collaborator

1uc commented Oct 29, 2024

I agree with the motivation, but I'm not sure I see why this moves the assert close enough to where the issue occurs to make a difference. The pattern is still:

expect = ...
actual = ...

assert expected == actual, f"..."

where actual was computed some time in the past; and the assert happens some time later.

One difference that might be unintended is that now an array of value does cause printing information for each entry. Rather it'll print something for the first value and then crash.

Copy link

✔️ 01feeb1 -> Azure artifacts URL

Copy link

codecov bot commented Oct 29, 2024

Codecov Report

Attention: Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.

Project coverage is 67.17%. Comparing base (cd7ac7d) to head (01feeb1).

Files with missing lines Patch % Lines
share/lib/python/neuron/tests/utils/checkresult.py 71.42% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3149   +/-   ##
=======================================
  Coverage   67.17%   67.17%           
=======================================
  Files         573      573           
  Lines      111439   111433    -6     
=======================================
- Hits        74856    74855    -1     
+ Misses      36583    36578    -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pramodk
Copy link
Member

pramodk commented Nov 10, 2024

One difference that might be unintended is that now an array of value does cause printing information for each entry. Rather it'll print something for the first value and then crash.

It would be good to take care of this.

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.

4 participants