Files
esphome/tests/unit_tests/fixtures/substitutions/00-simple_var.input.yaml
T

57 lines
1.4 KiB
YAML

esphome:
name: test
substitutions:
substituted: 99
var1: "1"
var2: "2"
var21: "79"
value: 33
values: 44
position:
x: 79
y: 82
a: 10
b: 20
# The following key is only used by the test framework
# to simulate command line substitutions
command_line_substitutions:
a: 15
test_list:
- "$var1"
- "${var1}"
- $var1
- ${var1}
- "Values: $var1 ${var2}"
- "Value: ${var2${var1}}"
- "$var1 + $var2"
- "${ var1 } * ${ var2 }"
- "Undefined var: ${undefined_var}"
- ${undefined_var}
- $undefined_var
- ${ undefined_var }
- key${var1}: 1
key${var2}: 2
- !literal Literal $values ${are not substituted}
- !literal ["list $value", "${is not}", "${substituted}"]
- !literal {"$dictionary": "$value", "${is not}": "${substituted}"}
- |- # Test parsing things that look like a python set of sets when rendered:
{{{ "x", "${ position.x }"}, { "y", "${ position.y }"}}}
- ${ '{{{"AA"}}}' }
- ${ '"HELLO"' }
- '{ ${position.x}, ${position.y} }'
- a: ${a} should be 15, overridden from command line
b: ${b} should stay as 20, not overridden
# Test merging lists when substituted keys resolve to an existing key
- ${ "aa" }: [1, 2, 3]
${ "a" + "a" }: [4, 5, 6]
${ "bb" }: [7, 8, 9]
# Test merging dicts when substituted keys resolve to an existing key
- ${ "aa" }: {"x": 1, "y": 2}
${ "a" + "a" }: {"y": 3, "z": 4}
${ "bb" }: {"w": 5}