Skip to content

Commit

Permalink
Improve error message wording
Browse files Browse the repository at this point in the history
  • Loading branch information
joelostblom committed Mar 26, 2023
1 parent ed59830 commit 50c12f7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion altair/vegalite/v5/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ def condition(predicate, if_true, if_false, **kwargs):
elif isinstance(if_true, str):
if isinstance(if_false, str):
raise ValueError(
"A field cannot be used in both the `if_true` and `if_false` branches of a condition. One of the them has to specify a `value` or `datum` definition."
"A field cannot be used as both the `if_true` and `if_false` values of a condition. One of them has to specify a `value` or `datum` definition."
)
else:
if_true = utils.parse_shorthand(if_true)
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/test_schemapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ def test_chart_validation_errors(chart_func, expected_error_message):

def test_multiple_field_strings_in_condition():
selection = alt.selection_point()
expected_error_message = "A field cannot be used in both the `if_true` and `if_false` branches of a condition. One of the them has to specify a `value` or `datum` definition."
expected_error_message = "A field cannot be used as both the `if_true` and `if_false` values of a condition. One of them has to specify a `value` or `datum` definition."
with pytest.raises(ValueError, match=expected_error_message):
(
alt.Chart(data.cars())
Expand Down

0 comments on commit 50c12f7

Please sign in to comment.