Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Bills committed Dec 13, 2024
1 parent 62e8f3b commit 17293aa
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/pybamm/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,16 @@ def __getitem__(self, key):
) from error
best_matches = self.get_best_matches(key)
for k in best_matches:
if key in k and k.endswith("]"):
if key in k and k.endswith("]") and not key.endswith("]"):
raise KeyError(
f"'{key}' not found. Use the dimensional version '{k}' instead."
) from error
elif key in k and (
k.startswith("Primary") or k.startswith("Secondary")
):
raise KeyError(

Check warning on line 104 in src/pybamm/util.py

View check run for this annotation

Codecov / codecov/patch

src/pybamm/util.py#L104

Added line #L104 was not covered by tests
f"'{key}' not found. If you are using a composite model, you may need to use {k} instead. Otherwise, best matches are {best_matches}"
) from error
raise KeyError(
f"'{key}' not found. Best matches are {best_matches}"
) from error
Expand Down

0 comments on commit 17293aa

Please sign in to comment.