mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Update template sensor to use async_track_template_result (#38940)
* Add template entity * Update template tracking to work for template sensors * add test for whitespace * Update homeassistant/helpers/config_validation.py * revert * fix * reduce * fix _refresh missing decorator * defer until start * do not throw errors during startup * defer tracking until start event Co-authored-by: Swamp-Ig <github@ninjateaparty.com>
This commit is contained in:
@@ -1092,3 +1092,24 @@ def test_script(caplog):
|
||||
cv.script_action(data)
|
||||
|
||||
assert msg in str(excinfo.value)
|
||||
|
||||
|
||||
def test_whitespace():
|
||||
"""Test whitespace validation."""
|
||||
schema = vol.Schema(cv.whitespace)
|
||||
|
||||
for value in (
|
||||
None,
|
||||
"" "T",
|
||||
"negative",
|
||||
"lock",
|
||||
"tr ue",
|
||||
[],
|
||||
[1, 2],
|
||||
{"one": "two"},
|
||||
):
|
||||
with pytest.raises(vol.MultipleInvalid):
|
||||
schema(value)
|
||||
|
||||
for value in (" ", " "):
|
||||
assert schema(value)
|
||||
|
||||
Reference in New Issue
Block a user