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

Raise ValueError for conflicting pH and H+ #205

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

gnuhpdiem
Copy link

Summary

Major changes:

Checklist

  • Google format doc strings added.
  • Code linted with ruff. (For guidance in fixing rule violates, see rule list)
  • Type annotations included. Check with mypy.
  • Tests added for new features/fixes.
  • I have run the tests locally and they passed.

Tip: Install pre-commit hooks to auto-check types and linting before every commit:

pip install -U pre-commit
pre-commit install

Copy link

codecov bot commented Nov 14, 2024

Codecov Report

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

Project coverage is 81.68%. Comparing base (9eabea0) to head (dec03d0).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/pyEQL/solution.py 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #205      +/-   ##
==========================================
+ Coverage   75.70%   81.68%   +5.98%     
==========================================
  Files           9        9              
  Lines        1494     1496       +2     
  Branches      256      257       +1     
==========================================
+ Hits         1131     1222      +91     
+ Misses        317      227      -90     
- Partials       46       47       +1     

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

src/pyEQL/solution.py Outdated Show resolved Hide resolved
@rkingsbury
Copy link
Member

Thank you @gnuhpdiem this looks good to me. Could you please also add another branch to the conditional that logs a warning if H[+1] is found in the solutes but pH IS the default value? Something that tells the user "H[+1] = {value} found in solutes. Overriding default pH with this value." or something like that?

Note that you should use self.logger.warning() rather than directly calling warn().

After that, please add tests for both branches here. You can see an example of how to capture a warning message in the tests here.

Finally, please install pre-commit and run pre-commit run to apply linting / formatting.

@gnuhpdiem
Copy link
Author

Thanks for your detailed review! I'll update the PR soon with the requested changes!

@rkingsbury
Copy link
Member

This looks terrific @gnuhpdiem , thank you! I believe the test failures are due to an unrelated dependency update, which I will address soon. Once I do that, I'll rerun the tests and as long as they pass, this is ready to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement: prevent accidental double-setting of pH
2 participants