Improve Python script#9417
Merged
Merged
Conversation
add datetime to builtin and support for unpacksequence a,b = (1,2) for a,b in [(1,2),(3,4)]
houndci-bot
reviewed
Sep 13, 2017
| python_script.execute(self.hass, 'dummy.py', source, data) | ||
| assert data['a'] == 1 | ||
| assert data['b'] == 2 | ||
| assert data['ab_list'] == [(1,2),(3,4)] |
| }, | ||
| }) | ||
| source = ''' | ||
|
|
|
|
||
| def test_unpack_sequence(self): | ||
| calls = [] | ||
| @callback |
There was a problem hiding this comment.
expected 1 blank line before a nested definition, found 0
|
|
||
| def test_datetime(self): | ||
| pass | ||
|
|
| def tearDown(self): | ||
| """Stop down everything that was started.""" | ||
| self.hass.stop() | ||
|
|
balloob
reviewed
Sep 14, 2017
|
|
||
|
|
||
| @asyncio.coroutine | ||
| def test_setup(hass): |
restore previous tests, removed by mistake sorry...
houndci-bot
reviewed
Sep 14, 2017
| assert data['a'] == 1 | ||
| assert data['b'] == 2 | ||
| assert data['ab_list'] == [(1,2),(3,4)] | ||
|
|
|
|
||
| assert data['a'] == 1 | ||
| assert data['b'] == 2 | ||
| assert data['ab_list'] == [(1,2),(3,4)] |
| data = {} | ||
| hass.async_add_job(execute, hass, 'test.py', source, data) | ||
| yield from hass.async_block_till_done() | ||
|
|
| for i in [1, 2]: | ||
| hass.states.set('hello.{}'.format(i), 'world') | ||
| """ | ||
|
|
| assert hass.states.is_state('hello.1', 'world') | ||
| assert hass.states.is_state('hello.2', 'world') | ||
|
|
||
| @asyncio.coroutine |
|
|
||
| assert hass.states.is_state('hello.1', 'world') | ||
| assert hass.states.is_state('hello.2', 'world') | ||
|
|
houndci-bot
reviewed
Sep 14, 2017
| data['b'] = b | ||
| data['ab_list'] = ab_list | ||
| """ | ||
|
|
balloob
approved these changes
Sep 14, 2017
Member
balloob
left a comment
There was a problem hiding this comment.
Ok to merge when TravisCI passes.
houndci-bot
reviewed
Sep 14, 2017
| assert hass.states.is_state('a', 1) | ||
| assert hass.states.is_state('b', 2) | ||
| assert hass.states.is_state('ab_list', '[(1, 2), (3, 4)]') | ||
|
|
houndci-bot
reviewed
Sep 14, 2017
| assert hass.states.is_state('a', 1) | ||
| assert hass.states.is_state('b', 2) | ||
| assert hass.states.is_state('ab_list', '[(1, 2), (3, 4)]') | ||
|
|
Member
|
Awesome, thanks! 🐬 🎉 |
Contributor
Author
|
thanks to you for providing HA ! :) |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add datetime to builtin and support for unpacking sequence
example:
a,b = (1,2)
for a,b in [(1,2),(3,4)]