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

Added descriptive error text to assert statements #1816

Merged
merged 4 commits into from
Nov 23, 2024

Conversation

cpilko
Copy link
Contributor

@cpilko cpilko commented Nov 20, 2024

Changes proposed in this pull request

  • Added descriptive error text to two assert statements in interfaces/cython/cantera/composite.py

Closes #

If applicable, provide an example illustrating new features this pull request is introducing

Checklist

  • [ x ] The pull request includes a clear description of this code change
  • [ x ] Commit messages have short titles and reference relevant issues
  • Build passes (scons build & scons test) and unit tests address code coverage
  • [ x ] Style & formatting of contributed code follows contributing guidelines
  • [ x ] The pull request is ready for review

@bryanwweber
Copy link
Member

Hi! Thanks for making this change. I think this is definitely an improvement.

Since you're editing these lines anyways, ideally we would actually change these into full if statements, raising an appropriate ValueError. The reason is that interpreter options can be set for Python that disable assert statements at runtime, so these guards would no longer be effective.

Please also address the changes suggested by the linter: https://github.com/Cantera/cantera/actions/runs/11936944028/job/33273168168?pr=1816, in particular making sure not to introduce any extra spaces at the ends of lines. You can continue to push changes to this branch to update the pull request.

Thank you!

As requested by @brianweber.

Made syntax of other ValueError statements consistent.
Copy link
Member

@bryanwweber bryanwweber left a comment

Choose a reason for hiding this comment

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

Thanks for the quick updates! Just one more tiny change to the formatting ☺️

interfaces/cython/cantera/composite.py Outdated Show resolved Hide resolved
Copy link

codecov bot commented Nov 22, 2024

Codecov Report

Attention: Patch coverage is 20.00000% with 8 lines in your changes missing coverage. Please review.

Project coverage is 73.25%. Comparing base (ad41b31) to head (27312a5).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
interfaces/cython/cantera/composite.py 20.00% 4 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1816      +/-   ##
==========================================
- Coverage   73.26%   73.25%   -0.02%     
==========================================
  Files         383      383              
  Lines       54621    54625       +4     
  Branches     9099     9103       +4     
==========================================
- Hits        40017    40013       -4     
- Misses      11601    11605       +4     
- Partials     3003     3007       +4     

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


🚨 Try these New Features:

@bryanwweber
Copy link
Member

Thank you! The test failures on macOS don't seem related to the changes here, but let's see what happens this time. I will merge this as soon as the tests look good!

@bryanwweber bryanwweber merged commit 60e1310 into Cantera:main Nov 23, 2024
49 of 57 checks passed
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