Rendering complex template objects to leave non-template values alone (#29353)
This commit is contained in:
parent
b1b784484e
commit
eef91f843d
4 changed files with 18 additions and 4 deletions
|
@ -395,7 +395,7 @@ def test_template_complex():
|
|||
"""Test template_complex validator."""
|
||||
schema = vol.Schema(cv.template_complex)
|
||||
|
||||
for value in (None, "{{ partial_print }", "{% if True %}Hello"):
|
||||
for value in ("{{ partial_print }", "{% if True %}Hello"):
|
||||
with pytest.raises(vol.MultipleInvalid):
|
||||
schema(value)
|
||||
|
||||
|
@ -420,6 +420,10 @@ def test_template_complex():
|
|||
["{{ beer }}", 1],
|
||||
)
|
||||
|
||||
# Ensure we don't mutate non-string types that cannot be templates.
|
||||
for value in (1, True, None):
|
||||
assert schema(value) == value
|
||||
|
||||
|
||||
def test_time_zone():
|
||||
"""Test time zone validation."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue