mirror of
https://github.com/home-assistant/core.git
synced 2025-12-23 20:39:01 +00:00
Allow iteration in python_script (#8134)
* Allow iteration in python_script * Add tests
This commit is contained in:
committed by
Pascal Vizeli
parent
4d2b79156d
commit
6398e92836
@@ -149,3 +149,18 @@ hass.stop()
|
||||
yield from hass.async_block_till_done()
|
||||
|
||||
assert "Not allowed to access HomeAssistant.stop" in caplog.text
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def test_iterating(hass):
|
||||
"""Test compile error logs error."""
|
||||
source = """
|
||||
for i in [1, 2]:
|
||||
hass.states.set('hello.{}'.format(i), 'world')
|
||||
"""
|
||||
|
||||
hass.async_add_job(execute, hass, 'test.py', source, {})
|
||||
yield from hass.async_block_till_done()
|
||||
|
||||
assert hass.states.is_state('hello.1', 'world')
|
||||
assert hass.states.is_state('hello.2', 'world')
|
||||
|
||||
Reference in New Issue
Block a user