Skip to content

Commit

Permalink
test: Update test_chart_validation_errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dangotbanned committed Jan 2, 2025
1 parent fe5c840 commit 21f1cff
Showing 1 changed file with 24 additions and 23 deletions.
47 changes: 24 additions & 23 deletions tests/utils/test_schemapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import io
import json
import pickle
import re
import types
import warnings
from collections import deque
Expand Down Expand Up @@ -661,7 +662,7 @@ def id_func_chart_error_example(val) -> str:
chart_funcs_error_message: list[tuple[Callable[..., Any], str]] = [
(
chart_error_example__invalid_y_option_value_unknown_x_option,
r"""Multiple errors were found.
rf"""Multiple errors were found.
Error 1: `X` has no parameter named 'unknown'
Expand All @@ -676,21 +677,21 @@ def id_func_chart_error_example(val) -> str:
Error 2: 'asdf' is an invalid value for `stack`. Valid values are:
- One of \['zero', 'center', 'normalize'\]
- Of type 'null' or 'boolean'$""",
- Of type {re.escape("`bool | None`")}$""",
),
(
chart_error_example__wrong_tooltip_type_in_faceted_chart,
r"""'\['wrong'\]' is an invalid value for `field`. Valid values are of type 'string' or 'object'.$""",
rf"""'\['wrong'\]' is an invalid value for `field`. Valid values are of type {re.escape("`str | Mapping[str, Any]`")}.$""",
),
(
chart_error_example__wrong_tooltip_type_in_layered_chart,
r"""'\['wrong'\]' is an invalid value for `field`. Valid values are of type 'string' or 'object'.$""",
rf"""'\['wrong'\]' is an invalid value for `field`. Valid values are of type {re.escape("`str | Mapping[str, Any]`")}.$""",
),
(
chart_error_example__two_errors_in_layered_chart,
r"""Multiple errors were found.
rf"""Multiple errors were found.
Error 1: '\['wrong'\]' is an invalid value for `field`. Valid values are of type 'string' or 'object'.
Error 1: '\['wrong'\]' is an invalid value for `field`. Valid values are of type {re.escape("`str | Mapping[str, Any]`")}.
Error 2: `Color` has no parameter named 'invalidArgument'
Expand All @@ -703,17 +704,17 @@ def id_func_chart_error_example(val) -> str:
),
(
chart_error_example__two_errors_in_complex_concat_layered_chart,
r"""Multiple errors were found.
rf"""Multiple errors were found.
Error 1: '\['wrong'\]' is an invalid value for `field`. Valid values are of type 'string' or 'object'.
Error 1: '\['wrong'\]' is an invalid value for `field`. Valid values are of type {re.escape("`str | Mapping[str, Any]`")}.
Error 2: '4' is an invalid value for `bandPosition`. Valid values are of type 'number'.$""",
Error 2: '4' is an invalid value for `bandPosition`. Valid values are of type `float`.$""",
),
(
chart_error_example__three_errors_in_complex_concat_layered_chart,
r"""Multiple errors were found.
rf"""Multiple errors were found.
Error 1: '\['wrong'\]' is an invalid value for `field`. Valid values are of type 'string' or 'object'.
Error 1: '\['wrong'\]' is an invalid value for `field`. Valid values are of type {re.escape("`str | Mapping[str, Any]`")}.
Error 2: `Color` has no parameter named 'invalidArgument'
Expand All @@ -724,7 +725,7 @@ def id_func_chart_error_example(val) -> str:
See the help for `Color` to read the full description of these parameters
Error 3: '4' is an invalid value for `bandPosition`. Valid values are of type 'number'.$""",
Error 3: '4' is an invalid value for `bandPosition`. Valid values are of type `float`.$""",
),
(
chart_error_example__two_errors_with_one_in_nested_layered_chart,
Expand Down Expand Up @@ -764,46 +765,46 @@ def id_func_chart_error_example(val) -> str:
),
(
chart_error_example__invalid_y_option_value,
r"""'asdf' is an invalid value for `stack`. Valid values are:
rf"""'asdf' is an invalid value for `stack`. Valid values are:
- One of \['zero', 'center', 'normalize'\]
- Of type 'null' or 'boolean'$""",
- Of type {re.escape("`bool | None`")}$""",
),
(
chart_error_example__invalid_y_option_value_with_condition,
r"""'asdf' is an invalid value for `stack`. Valid values are:
rf"""'asdf' is an invalid value for `stack`. Valid values are:
- One of \['zero', 'center', 'normalize'\]
- Of type 'null' or 'boolean'$""",
- Of type {re.escape("`bool | None`")}$""",
),
(
chart_error_example__hconcat,
r"""'{'text': 'Horsepower', 'align': 'right'}' is an invalid value for `title`. Valid values are of type 'string', 'array', or 'null'.$""",
rf"""'{{'text': 'Horsepower', 'align': 'right'}}' is an invalid value for `title`. Valid values are of type {re.escape("`str | Sequence | None`")}.$""",
),
(
chart_error_example__invalid_timeunit_value,
r"""'invalid_value' is an invalid value for `timeUnit`. Valid values are:
rf"""'invalid_value' is an invalid value for `timeUnit`. Valid values are:
- One of \['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'\]
- One of \['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'\]
- One of \['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'\]
- One of \['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'\]
- One of \['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'\]
- One of \['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'\]
- Of type 'object'$""",
- Of type {re.escape("`Mapping[str, Any]`")}$""",
),
(
chart_error_example__invalid_sort_value,
r"""'invalid_value' is an invalid value for `sort`. Valid values are:
rf"""'invalid_value' is an invalid value for `sort`. Valid values are:
- One of \['ascending', 'descending'\]
- One of \['x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'\]
- One of \['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text'\]
- Of type 'array', 'object', or 'null'$""",
- Of type {re.escape("`Sequence | Mapping[str, Any] | None`")}$""",
),
(
chart_error_example__invalid_bandposition_value,
r"""'4' is an invalid value for `bandPosition`. Valid values are of type 'number'.$""",
r"""'4' is an invalid value for `bandPosition`. Valid values are of type `float`.$""",
),
(
chart_error_example__invalid_type,
Expand All @@ -823,7 +824,7 @@ def id_func_chart_error_example(val) -> str:
),
(
chart_error_example__invalid_value_type,
r"""'1' is an invalid value for `value`. Valid values are of type 'object', 'string', or 'null'.$""",
rf"""'1' is an invalid value for `value`. Valid values are of type {re.escape("`str | Mapping[str, Any] | None`")}.$""",
),
(
chart_error_example__four_errors_hide_fourth,
Expand Down

0 comments on commit 21f1cff

Please sign in to comment.