mirror of
https://github.com/home-assistant/core.git
synced 2025-08-04 21:25:13 +02:00
Add default to from_json (#146211)
This commit is contained in:
@@ -1494,6 +1494,15 @@ def test_from_json(hass: HomeAssistant) -> None:
|
||||
).async_render()
|
||||
assert actual_result == expected_result
|
||||
|
||||
info = render_to_info(hass, "{{ 'garbage string' | from_json }}")
|
||||
with pytest.raises(TemplateError, match="no default was specified"):
|
||||
info.result()
|
||||
|
||||
actual_result = template.Template(
|
||||
"{{ 'garbage string' | from_json('Bar') }}", hass
|
||||
).async_render()
|
||||
assert actual_result == expected_result
|
||||
|
||||
|
||||
def test_average(hass: HomeAssistant) -> None:
|
||||
"""Test the average filter."""
|
||||
|
Reference in New Issue
Block a user