Added sorted() to python_script (#10621)
* added sorted() to python_script * fixed lint errors
This commit is contained in:
parent
24aeea5ca3
commit
f052a0926b
2 changed files with 22 additions and 0 deletions
|
@ -209,6 +209,27 @@ hass.states.set('hello.ab_list', '{}'.format(ab_list))
|
|||
assert caplog.text == ''
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def test_execute_sorted(hass, caplog):
|
||||
"""Test sorted() function."""
|
||||
caplog.set_level(logging.ERROR)
|
||||
source = """
|
||||
a = sorted([3,1,2])
|
||||
assert(a == [1,2,3])
|
||||
hass.states.set('hello.a', a[0])
|
||||
hass.states.set('hello.b', a[1])
|
||||
hass.states.set('hello.c', a[2])
|
||||
"""
|
||||
hass.async_add_job(execute, hass, 'test.py', source, {})
|
||||
yield from hass.async_block_till_done()
|
||||
|
||||
assert hass.states.is_state('hello.a', '1')
|
||||
assert hass.states.is_state('hello.b', '2')
|
||||
assert hass.states.is_state('hello.c', '3')
|
||||
# No errors logged = good
|
||||
assert caplog.text == ''
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def test_exposed_modules(hass, caplog):
|
||||
"""Test datetime and time modules exposed."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue