Allow skip parsing template result (#42401)
This commit is contained in:
1 parent
80e8068b46
commit
45aba9bdf2
10 files changed
+98
-24
No files matched your search
@@ -2653,6 +2653,28 @@ async def test_legacy_templates(hass):
|
||||
)
|
||||
|
||||
|
||||
async def test_no_result_parsing(hass):
|
||||
"""Test if templates results are not parsed."""
|
||||
hass.states.async_set("sensor.temperature", "12")
|
||||
|
||||
assert (
|
||||
template.Template("{{ states.sensor.temperature.state }}", hass).async_render(
|
||||
parse_result=False
|
||||
)
|
||||
== "12"
|
||||
)
|
||||
|
||||
assert (
|
||||
template.Template("{{ false }}", hass).async_render(parse_result=False)
|
||||
== "False"
|
||||
)
|
||||
|
||||
assert (
|
||||
template.Template("{{ [1, 2, 3] }}", hass).async_render(parse_result=False)
|
||||
== "[1, 2, 3]"
|
||||
)
|
||||
|
||||
|
||||
async def test_is_static_still_ast_evals(hass):
|
||||
"""Test is_static still convers to native type."""
|
||||
tpl = template.Template("[1, 2]", hass)
|
||||
|
||||
Reference in new issue
Block a user