Fix PEP257 issues

This commit is contained in:
Fabian Affolter 2016-03-09 10:25:50 +01:00
parent d6eab03a61
commit 9838697d2b
120 changed files with 1447 additions and 1297 deletions

View file

@ -1,9 +1,4 @@
"""
tests.components.automation.test_mqtt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests mqtt automation.
"""
"""The tests for the MQTT automation."""
import unittest
import homeassistant.components.automation as automation
@ -12,9 +7,10 @@ from tests.common import (
class TestAutomationMQTT(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()
mock_mqtt_component(self.hass)
self.calls = []
@ -25,10 +21,11 @@ class TestAutomationMQTT(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_if_fires_on_topic_match(self):
"""Test if message is fired on topic match."""
self.assertTrue(automation.setup(self.hass, {
automation.DOMAIN: {
'platform': 'mqtt',
@ -42,6 +39,7 @@ class TestAutomationMQTT(unittest.TestCase):
self.assertEqual(1, len(self.calls))
def test_old_config_if_fires_on_topic_and_payload_match(self):
"""Test if message is fired on topic and payload match."""
self.assertTrue(automation.setup(self.hass, {
automation.DOMAIN: {
'platform': 'mqtt',
@ -56,6 +54,7 @@ class TestAutomationMQTT(unittest.TestCase):
self.assertEqual(1, len(self.calls))
def test_old_config_if_not_fires_on_topic_but_no_payload_match(self):
"""Test if message is not fired on topic but no payload."""
self.assertTrue(automation.setup(self.hass, {
automation.DOMAIN: {
'platform': 'mqtt',
@ -70,6 +69,7 @@ class TestAutomationMQTT(unittest.TestCase):
self.assertEqual(0, len(self.calls))
def test_if_fires_on_topic_match(self):
"""Test if message is fired on topic match."""
self.assertTrue(automation.setup(self.hass, {
automation.DOMAIN: {
'trigger': {
@ -87,6 +87,7 @@ class TestAutomationMQTT(unittest.TestCase):
self.assertEqual(1, len(self.calls))
def test_if_fires_on_topic_and_payload_match(self):
"""Test if message is fired on topic and payload match."""
self.assertTrue(automation.setup(self.hass, {
automation.DOMAIN: {
'trigger': {
@ -105,6 +106,7 @@ class TestAutomationMQTT(unittest.TestCase):
self.assertEqual(1, len(self.calls))
def test_if_not_fires_on_topic_but_no_payload_match(self):
"""Test if message is not fired on topic but no payload."""
self.assertTrue(automation.setup(self.hass, {
automation.DOMAIN: {
'trigger': {