Fix PEP257 issues
This commit is contained in:
parent
d6eab03a61
commit
9838697d2b
120 changed files with 1447 additions and 1297 deletions
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
tests.components.automation.test_init
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Tests automation component.
|
||||
"""
|
||||
"""The tests for the automation component."""
|
||||
import unittest
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
|
@ -13,9 +8,10 @@ from tests.common import get_test_home_assistant
|
|||
|
||||
|
||||
class TestAutomation(unittest.TestCase):
|
||||
""" Test the event automation. """
|
||||
"""Test the event automation."""
|
||||
|
||||
def setUp(self): # pylint: disable=invalid-name
|
||||
"""Setup things to be run when tests are started."""
|
||||
self.hass = get_test_home_assistant()
|
||||
self.calls = []
|
||||
|
||||
|
@ -25,10 +21,11 @@ class TestAutomation(unittest.TestCase):
|
|||
self.hass.services.register('test', 'automation', record_call)
|
||||
|
||||
def tearDown(self): # pylint: disable=invalid-name
|
||||
""" Stop down stuff we started. """
|
||||
"""Stop everything that was started."""
|
||||
self.hass.stop()
|
||||
|
||||
def test_old_config_service_data_not_a_dict(self):
|
||||
"""Test old configuration service data."""
|
||||
automation.setup(self.hass, {
|
||||
automation.DOMAIN: {
|
||||
'platform': 'event',
|
||||
|
@ -43,6 +40,7 @@ class TestAutomation(unittest.TestCase):
|
|||
self.assertEqual(1, len(self.calls))
|
||||
|
||||
def test_old_config_service_specify_data(self):
|
||||
"""Test old configuration service data."""
|
||||
automation.setup(self.hass, {
|
||||
automation.DOMAIN: {
|
||||
'platform': 'event',
|
||||
|
@ -58,6 +56,7 @@ class TestAutomation(unittest.TestCase):
|
|||
self.assertEqual('data', self.calls[0].data['some'])
|
||||
|
||||
def test_old_config_service_specify_entity_id(self):
|
||||
"""Test old configuration service data."""
|
||||
automation.setup(self.hass, {
|
||||
automation.DOMAIN: {
|
||||
'platform': 'event',
|
||||
|
@ -74,6 +73,7 @@ class TestAutomation(unittest.TestCase):
|
|||
self.calls[0].data.get(ATTR_ENTITY_ID))
|
||||
|
||||
def test_old_config_service_specify_entity_id_list(self):
|
||||
"""Test old configuration service data."""
|
||||
automation.setup(self.hass, {
|
||||
automation.DOMAIN: {
|
||||
'platform': 'event',
|
||||
|
@ -90,6 +90,7 @@ class TestAutomation(unittest.TestCase):
|
|||
self.calls[0].data.get(ATTR_ENTITY_ID))
|
||||
|
||||
def test_service_data_not_a_dict(self):
|
||||
"""Test service data not dict."""
|
||||
automation.setup(self.hass, {
|
||||
automation.DOMAIN: {
|
||||
'trigger': {
|
||||
|
@ -108,6 +109,7 @@ class TestAutomation(unittest.TestCase):
|
|||
self.assertEqual(1, len(self.calls))
|
||||
|
||||
def test_service_specify_data(self):
|
||||
"""Test service data."""
|
||||
automation.setup(self.hass, {
|
||||
automation.DOMAIN: {
|
||||
'trigger': {
|
||||
|
@ -127,6 +129,7 @@ class TestAutomation(unittest.TestCase):
|
|||
self.assertEqual('data', self.calls[0].data['some'])
|
||||
|
||||
def test_service_specify_entity_id(self):
|
||||
"""Test service data."""
|
||||
automation.setup(self.hass, {
|
||||
automation.DOMAIN: {
|
||||
'trigger': {
|
||||
|
@ -147,6 +150,7 @@ class TestAutomation(unittest.TestCase):
|
|||
self.calls[0].data.get(ATTR_ENTITY_ID))
|
||||
|
||||
def test_service_specify_entity_id_list(self):
|
||||
"""Test service data."""
|
||||
automation.setup(self.hass, {
|
||||
automation.DOMAIN: {
|
||||
'trigger': {
|
||||
|
@ -167,6 +171,7 @@ class TestAutomation(unittest.TestCase):
|
|||
self.calls[0].data.get(ATTR_ENTITY_ID))
|
||||
|
||||
def test_two_triggers(self):
|
||||
"""Test triggers."""
|
||||
automation.setup(self.hass, {
|
||||
automation.DOMAIN: {
|
||||
'trigger': [
|
||||
|
@ -193,6 +198,7 @@ class TestAutomation(unittest.TestCase):
|
|||
self.assertEqual(2, len(self.calls))
|
||||
|
||||
def test_two_conditions_with_and(self):
|
||||
"""Test two and conditions."""
|
||||
entity_id = 'test.entity'
|
||||
automation.setup(self.hass, {
|
||||
automation.DOMAIN: {
|
||||
|
@ -236,6 +242,7 @@ class TestAutomation(unittest.TestCase):
|
|||
self.assertEqual(1, len(self.calls))
|
||||
|
||||
def test_two_conditions_with_or(self):
|
||||
"""Test two or conditions."""
|
||||
entity_id = 'test.entity'
|
||||
automation.setup(self.hass, {
|
||||
automation.DOMAIN: {
|
||||
|
@ -280,7 +287,7 @@ class TestAutomation(unittest.TestCase):
|
|||
self.assertEqual(2, len(self.calls))
|
||||
|
||||
def test_using_trigger_as_condition(self):
|
||||
""" """
|
||||
"""Test triggers as condition."""
|
||||
entity_id = 'test.entity'
|
||||
automation.setup(self.hass, {
|
||||
automation.DOMAIN: {
|
||||
|
@ -316,7 +323,7 @@ class TestAutomation(unittest.TestCase):
|
|||
self.assertEqual(1, len(self.calls))
|
||||
|
||||
def test_using_trigger_as_condition_with_invalid_condition(self):
|
||||
""" Event is not a valid condition. Will it still work? """
|
||||
"""Event is not a valid condition."""
|
||||
entity_id = 'test.entity'
|
||||
self.hass.states.set(entity_id, 100)
|
||||
automation.setup(self.hass, {
|
||||
|
@ -344,7 +351,7 @@ class TestAutomation(unittest.TestCase):
|
|||
self.assertEqual(1, len(self.calls))
|
||||
|
||||
def test_automation_list_setting(self):
|
||||
""" Event is not a valid condition. Will it still work? """
|
||||
"""Event is not a valid condition."""
|
||||
self.assertTrue(automation.setup(self.hass, {
|
||||
automation.DOMAIN: [{
|
||||
'trigger': {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue