Skip to content

Improve Python script#9417

Merged
balloob merged 11 commits into
home-assistant:devfrom
doudz:python_script
Sep 14, 2017
Merged

Improve Python script#9417
balloob merged 11 commits into
home-assistant:devfrom
doudz:python_script

Conversation

@doudz
Copy link
Copy Markdown
Contributor

@doudz doudz commented Sep 13, 2017

Add datetime to builtin and support for unpacking sequence
example:
a,b = (1,2)
for a,b in [(1,2),(3,4)]

add datetime to builtin and support for unpacksequence
a,b = (1,2)
for a,b in [(1,2),(3,4)]
@mention-bot
Copy link
Copy Markdown

@doudz, thanks for your PR! By analyzing the history of the files in this pull request, we identified @balloob, @sdague and @open-homeautomation to be potential reviewers.

Comment thread tests/components/test_python_script.py Outdated
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)]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing whitespace after ','

Comment thread tests/components/test_python_script.py Outdated
},
})
source = '''

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

Comment thread tests/components/test_python_script.py Outdated

def test_unpack_sequence(self):
calls = []
@callback
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 1 blank line before a nested definition, found 0

Comment thread tests/components/test_python_script.py Outdated

def test_datetime(self):
pass

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

Comment thread tests/components/test_python_script.py Outdated
def tearDown(self):
"""Stop down everything that was started."""
self.hass.stop()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace



@asyncio.coroutine
def test_setup(hass):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't remove any tests

restore previous tests, removed by mistake sorry...
assert data['a'] == 1
assert data['b'] == 2
assert data['ab_list'] == [(1,2),(3,4)]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line at end of file

Comment thread tests/components/test_python_script.py Outdated

assert data['a'] == 1
assert data['b'] == 2
assert data['ab_list'] == [(1,2),(3,4)]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing whitespace after ','

Comment thread tests/components/test_python_script.py Outdated
data = {}
hass.async_add_job(execute, hass, 'test.py', source, data)
yield from hass.async_block_till_done()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

Comment thread tests/components/test_python_script.py Outdated
for i in [1, 2]:
hass.states.set('hello.{}'.format(i), 'world')
"""

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

assert hass.states.is_state('hello.1', 'world')
assert hass.states.is_state('hello.2', 'world')

@asyncio.coroutine
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1

Comment thread tests/components/test_python_script.py Outdated

assert hass.states.is_state('hello.1', 'world')
assert hass.states.is_state('hello.2', 'world')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

Comment thread tests/components/test_python_script.py Outdated
data['b'] = b
data['ab_list'] = ab_list
"""

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

Copy link
Copy Markdown
Member

@balloob balloob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok to merge when TravisCI passes.

Comment thread tests/components/test_python_script.py Outdated
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)]')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

Comment thread tests/components/test_python_script.py Outdated
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)]')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

@balloob balloob merged commit 20f3e3d into home-assistant:dev Sep 14, 2017
@balloob
Copy link
Copy Markdown
Member

balloob commented Sep 14, 2017

Awesome, thanks! 🐬 🎉

@doudz
Copy link
Copy Markdown
Contributor Author

doudz commented Sep 14, 2017

thanks to you for providing HA ! :)

@doudz doudz deleted the python_script branch September 14, 2017 14:57
@balloob balloob mentioned this pull request Sep 22, 2017
@home-assistant home-assistant locked and limited conversation to collaborators Mar 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants