new syntax

This commit is contained in:
Jesse Bannon 2023-10-14 16:36:47 -07:00
parent 8eeb9abe83
commit 54f882c6f5
2 changed files with 11 additions and 11 deletions

View file

@ -42,8 +42,8 @@ def maybe_indent_override_values(value: str) -> List[str]:
------- -------
Value if it is an overide [Value]. None otherwise. Value if it is an overide [Value]. None otherwise.
""" """
if value.startswith("[") and value.endswith("]"): if value.startswith("=[") and value.endswith("]"):
return value[1:-1].split("][") return value[2:-1].split("|")
return [] return []

View file

@ -98,9 +98,9 @@ def preset_with_subscription_value_nested_presets_and_indent_variables(
preset_with_subscription_value, preset_with_subscription_value,
**{ **{
"parent_preset_2": { "parent_preset_2": {
"[INDENT_1]": { "=[INDENT_1]": {
"parent_preset_1": {"test_2_1": "is_2_1_overwritten"}, "parent_preset_1": {"test_2_1": "is_2_1_overwritten"},
"[INDENT_2]": { "=[INDENT_2]": {
"test_1": "is_1_overwritten", "test_1": "is_1_overwritten",
}, },
} }
@ -117,9 +117,9 @@ def preset_with_subscription_value_nested_presets_and_indent_variables_same_line
preset_with_subscription_value, preset_with_subscription_value,
**{ **{
"parent_preset_2": { "parent_preset_2": {
"[INDENT_1]": { "=[INDENT_1]": {
"parent_preset_1": {"test_2_1": "is_2_1_overwritten"}, "parent_preset_1": {"test_2_1": "is_2_1_overwritten"},
"[INDENT_2][INDENT_3]": { "=[INDENT_2|INDENT_3]": {
"test_1": "is_1_overwritten", "test_1": "is_1_overwritten",
}, },
} }
@ -308,11 +308,11 @@ def test_subscription_file_bad_value(config_file: ConfigFile):
def test_subscription_file_using_value_when_not_defined(config_file: ConfigFile): def test_subscription_file_using_value_when_not_defined(config_file: ConfigFile):
with mock_load_yaml( with mock_load_yaml(
preset_dict={"[INDENTS_IN_ERR_MSG]": {"sub_name": "single value, __value__ not defined"}} preset_dict={"=[INDENTS_IN_ERR_MSG]": {"sub_name": "single value, __value__ not defined"}}
), pytest.raises( ), pytest.raises(
ValidationException, ValidationException,
match=re.escape( match=re.escape(
"Validation error in [INDENTS_IN_ERR_MSG].sub_name: Subscription " "Validation error in =[INDENTS_IN_ERR_MSG].sub_name: Subscription "
"sub_name is a string, but the subscription value is not set to an override variable" "sub_name is a string, but the subscription value is not set to an override variable"
), ),
): ):
@ -322,14 +322,14 @@ def test_subscription_file_using_value_when_not_defined(config_file: ConfigFile)
def test_subscription_file_using_conflicting_preset_name(config_file: ConfigFile): def test_subscription_file_using_conflicting_preset_name(config_file: ConfigFile):
with mock_load_yaml( with mock_load_yaml(
preset_dict={ preset_dict={
"[INDENTS_IN_ERR_MSG]": { "=[INDENTS_IN_ERR_MSG]": {
"[ANOTHER]": {"jellyfin_tv_show_by_date": "single value, __value__ not defined"} "=[ANOTHER]": {"jellyfin_tv_show_by_date": "single value, __value__ not defined"}
} }
} }
), pytest.raises( ), pytest.raises(
ValidationException, ValidationException,
match=re.escape( match=re.escape(
"Validation error in [INDENTS_IN_ERR_MSG].[ANOTHER].jellyfin_tv_show_by_date: " "Validation error in =[INDENTS_IN_ERR_MSG].=[ANOTHER].jellyfin_tv_show_by_date: "
"jellyfin_tv_show_by_date conflicts with an existing preset name and cannot be used " "jellyfin_tv_show_by_date conflicts with an existing preset name and cannot be used "
"as a subscription name" "as a subscription name"
), ),