From 50c12f7acbe2f19ea33a10ed36a20dc971641ff7 Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Sun, 26 Mar 2023 11:18:25 -0700 Subject: [PATCH] Improve error message wording --- altair/vegalite/v5/api.py | 2 +- tests/utils/test_schemapi.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/altair/vegalite/v5/api.py b/altair/vegalite/v5/api.py index 29547ff0c..34031b024 100644 --- a/altair/vegalite/v5/api.py +++ b/altair/vegalite/v5/api.py @@ -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) diff --git a/tests/utils/test_schemapi.py b/tests/utils/test_schemapi.py index 847688e53..36d946e59 100644 --- a/tests/utils/test_schemapi.py +++ b/tests/utils/test_schemapi.py @@ -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())