Fix PEP257 issues

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

No files matched your search

+1
View File
@@ -0,0 +1 @@
"""The tests for Lock platforms."""
+7 -10
View File
@@ -1,9 +1,4 @@
"""
tests.components.lock.test_demo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests demo lock component.
"""
"""The tests for the Demo lock platform."""
import unittest
from homeassistant.components import lock
@@ -16,9 +11,10 @@ KITCHEN = 'lock.kitchen_door'
class TestLockDemo(unittest.TestCase):
""" Test the demo lock. """
"""Test the demo lock."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.assertTrue(lock.setup(self.hass, {
'lock': {
@@ -27,10 +23,11 @@ class TestLockDemo(unittest.TestCase):
}))
def tearDown(self): # pylint: disable=invalid-name
""" Stop down stuff we started. """
"""Stop everything that was started."""
self.hass.stop()
def test_is_locked(self):
"""Test if lock is locked."""
self.assertTrue(lock.is_locked(self.hass, FRONT))
self.hass.states.is_state(FRONT, 'locked')
@@ -38,15 +35,15 @@ class TestLockDemo(unittest.TestCase):
self.hass.states.is_state(KITCHEN, 'unlocked')
def test_locking(self):
"""Test the locking of a lock."""
lock.lock(self.hass, KITCHEN)
self.hass.pool.block_till_done()
self.assertTrue(lock.is_locked(self.hass, KITCHEN))
def test_unlocking(self):
"""Test the unlocking of a lock."""
lock.unlock(self.hass, FRONT)
self.hass.pool.block_till_done()
self.assertFalse(lock.is_locked(self.hass, FRONT))
+7 -4
View File
@@ -1,6 +1,4 @@
"""
Tests MQTT lock.
"""
"""The tests for the MQTT lock platform."""
import unittest
from homeassistant.const import (STATE_LOCKED, STATE_UNLOCKED,
@@ -12,15 +10,18 @@ from tests.common import (
class TestLockMQTT(unittest.TestCase):
"""Test the MQTT lock."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.mock_publish = mock_mqtt_component(self.hass)
def tearDown(self): # pylint: disable=invalid-name
"""Stop down stuff we started."""
"""Stop everything that was started."""
self.hass.stop()
def test_controlling_state_via_topic(self):
"""Test the controlling state via topic."""
self.assertTrue(lock.setup(self.hass, {
'lock': {
'platform': 'mqtt',
@@ -49,6 +50,7 @@ class TestLockMQTT(unittest.TestCase):
self.assertEqual(STATE_UNLOCKED, state.state)
def test_sending_mqtt_commands_and_optimistic(self):
"""Test the sending MQTT commands in optimistic mode."""
self.assertTrue(lock.setup(self.hass, {
'lock': {
'platform': 'mqtt',
@@ -81,6 +83,7 @@ class TestLockMQTT(unittest.TestCase):
self.assertEqual(STATE_UNLOCKED, state.state)
def test_controlling_state_via_topic_and_json_message(self):
"""Test the controlling state via topic and JSON message."""
self.assertTrue(lock.setup(self.hass, {
'lock': {
'platform': 'mqtt',