Add round to half template method (#28948)

* added round to half method

Signed-off-by: Tobias Perschon <tobias@perschon.at>

* testcase for new round method

Signed-off-by: Tobias Perschon <tobias@perschon.at>
This commit is contained in:
Tobias Perschon authored and Paulus Schoutsen committed 2019-11-22 10:08:41 -08:00
1 parent 6d77c15f28
commit d92f48646a
2 files changed
+9

No files matched your search

+7
View File
@@ -227,6 +227,13 @@ def test_rounding_value(hass):
== "12.8"
)
assert (
template.Template(
'{{ states.sensor.temperature.state | round(1, "half") }}', hass
).async_render()
== "13.0"
)
def test_rounding_value_get_original_value_on_error(hass):
"""Test rounding value get original value on error."""