Skip to content

Commit

Permalink
Raise ValueError for conflicting pH and H+
Browse files Browse the repository at this point in the history
  • Loading branch information
gnuhpdiem committed Nov 14, 2024
1 parent 17b8d33 commit dec03d0
Showing 1 changed file with 5 additions and 0 deletions.
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 @@ def __init__(
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

if isinstance(self._solutes, dict):
for k, v in self._solutes.items():
self.add_solute(k, v)
Expand Down

0 comments on commit dec03d0

Please sign in to comment.