Undecorate RenderInfo result property (#39108)
parent
3e9963a216
commit
e55a014e94
|
@ -680,7 +680,7 @@ class _TrackTemplateResultInfo:
|
||||||
info_changed = True
|
info_changed = True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result: Union[str, TemplateError] = self._info[template].result
|
result: Union[str, TemplateError] = self._info[template].result()
|
||||||
except TemplateError as ex:
|
except TemplateError as ex:
|
||||||
result = ex
|
result = ex
|
||||||
|
|
||||||
|
|
|
@ -175,7 +175,6 @@ class RenderInfo:
|
||||||
split_entity_id(entity_id)[0] in self.domains or entity_id in self.entities
|
split_entity_id(entity_id)[0] in self.domains or entity_id in self.entities
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
|
||||||
def result(self) -> str:
|
def result(self) -> str:
|
||||||
"""Results of the template computation."""
|
"""Results of the template computation."""
|
||||||
if self.exception is not None:
|
if self.exception is not None:
|
||||||
|
|
|
@ -51,7 +51,7 @@ def extract_entities(hass, template_str, variables=None):
|
||||||
|
|
||||||
def assert_result_info(info, result, entities=None, domains=None, all_states=False):
|
def assert_result_info(info, result, entities=None, domains=None, all_states=False):
|
||||||
"""Check result info."""
|
"""Check result info."""
|
||||||
assert info.result == result
|
assert info.result() == result
|
||||||
assert info.all_states == all_states
|
assert info.all_states == all_states
|
||||||
assert info.filter_lifecycle("invalid_entity_name.somewhere") == all_states
|
assert info.filter_lifecycle("invalid_entity_name.somewhere") == all_states
|
||||||
if entities is not None:
|
if entities is not None:
|
||||||
|
@ -96,7 +96,7 @@ def test_invalid_template(hass):
|
||||||
|
|
||||||
info = tmpl.async_render_to_info()
|
info = tmpl.async_render_to_info()
|
||||||
with pytest.raises(TemplateError):
|
with pytest.raises(TemplateError):
|
||||||
assert info.result == "impossible"
|
assert info.result() == "impossible"
|
||||||
|
|
||||||
tmpl = template.Template("{{states(keyword)}}", hass)
|
tmpl = template.Template("{{states(keyword)}}", hass)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue