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
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/pyEQL/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,11 @@
self._solutes = solutes
if self._solutes is None:
self._solutes = {}

# if user specifies non-default pH AND has H+ in solutes
if self._pH != 7 and "H+" in self._solutes:
raise ValueError("Cannot specify both a non-default pH and H+ at the same time. Please provide only one.")

Check warning on line 255 in src/pyEQL/solution.py

View check run for this annotation

Codecov / codecov/patch

src/pyEQL/solution.py#L255

Added line #L255 was not covered by tests

rkingsbury marked this conversation as resolved.
Show resolved Hide resolved
if isinstance(self._solutes, dict):
for k, v in self._solutes.items():
self.add_solute(k, v)
Expand Down