From 00afaac54cb12f4eec330c78dc3188730af6d2b5 Mon Sep 17 00:00:00 2001
From: Fabian Affolter <fabian@affolter-engineering.ch>
Date: Sat, 13 Feb 2016 14:19:11 +0100
Subject: [PATCH] Update for file header, docstrings, and PEP8/PEP257

---
 tests/__init__.py                             |  6 ++
 tests/common.py                               |  4 +-
 tests/components/automation/test_init.py      |  1 +
 .../automation/test_numeric_state.py          | 18 ++---
 tests/components/automation/test_state.py     |  2 +-
 tests/components/automation/test_template.py  |  2 +-
 tests/components/automation/test_zone.py      |  4 +-
 .../binary_sensor/test_command_sensor.py      |  3 +-
 tests/components/device_tracker/test_init.py  |  4 +-
 .../device_tracker/test_locative.py           | 11 ++-
 tests/components/device_tracker/test_mqtt.py  |  6 ++
 .../device_tracker/test_owntracks.py          | 22 +++---
 tests/components/garage_door/test_demo.py     |  2 +-
 tests/components/light/test_init.py           |  8 +-
 tests/components/light/test_mqtt.py           |  2 +-
 tests/components/media_player/test_demo.py    |  5 --
 tests/components/notify/test_demo.py          |  3 +-
 tests/components/rollershutter/test_mqtt.py   |  2 +-
 .../components/sensor/test_command_sensor.py  | 15 ++--
 tests/components/sensor/test_mfi.py           |  2 +-
 tests/components/sensor/test_mqtt.py          |  2 +-
 tests/components/sensor/test_template.py      |  5 +-
 tests/components/sensor/test_yr.py            |  4 +-
 .../components/switch/test_command_switch.py  |  6 +-
 tests/components/switch/test_init.py          |  4 +-
 tests/components/switch/test_mfi.py           |  2 +-
 tests/components/switch/test_mqtt.py          |  4 +-
 tests/components/switch/test_template.py      |  7 +-
 tests/components/test_alexa.py                |  6 +-
 tests/components/test_api.py                  |  4 +-
 tests/components/test_configurator.py         |  4 +-
 tests/components/test_conversation.py         |  2 +-
 tests/components/test_demo.py                 |  2 +-
 .../test_device_sun_light_trigger.py          |  2 +-
 tests/components/test_frontend.py             |  2 +-
 tests/components/test_graphite.py             |  2 +-
 tests/components/test_group.py                |  2 +-
 tests/components/test_history.py              |  4 +-
 tests/components/test_influx.py               |  2 +-
 tests/components/test_init.py                 |  4 +-
 tests/components/test_introduction.py         |  7 +-
 tests/components/test_logbook.py              |  4 +-
 tests/components/test_logger.py               |  4 +-
 tests/components/test_mqtt.py                 | 14 ++--
 tests/components/test_mqtt_eventstream.py     |  4 +-
 tests/components/test_proximity.py            | 78 +++++++++----------
 tests/components/test_recorder.py             |  2 +-
 tests/components/test_shell_command.py        |  6 +-
 tests/components/test_splunk.py               |  3 +-
 tests/components/test_statsd.py               |  4 +-
 tests/components/test_sun.py                  |  4 +-
 tests/components/test_updater.py              |  4 +-
 tests/components/test_weblink.py              |  7 +-
 tests/components/test_zone.py                 |  2 +-
 .../thermostat/test_heat_control.py           |  3 +-
 .../custom_components/device_tracker/test.py  |  4 +-
 tests/config/custom_components/light/test.py  |  4 +-
 tests/config/custom_components/switch/test.py |  4 +-
 tests/helpers/test_entity.py                  |  4 +-
 tests/helpers/test_entity_component.py        |  4 +-
 tests/helpers/test_event.py                   |  2 +-
 tests/helpers/test_event_decorators.py        |  2 +-
 tests/helpers/test_init.py                    |  4 +-
 tests/helpers/test_service.py                 |  4 +-
 tests/helpers/test_state.py                   | 12 ++-
 tests/test_config.py                          |  3 +-
 tests/test_core.py                            |  2 +-
 tests/test_loader.py                          |  4 +-
 tests/test_remote.py                          |  2 +-
 tests/util/test_color.py                      |  3 +
 tests/util/test_dt.py                         |  4 +-
 tests/util/test_init.py                       |  4 +-
 tests/util/test_package.py                    | 13 ++--
 tests/util/test_template.py                   |  6 +-
 74 files changed, 212 insertions(+), 211 deletions(-)

diff --git a/tests/__init__.py b/tests/__init__.py
index 4ae2e497414..e582287f941 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -1,3 +1,9 @@
+"""
+tests.__init__
+~~~~~~~~~~~~~~
+
+Tests initialization.
+"""
 import betamax
 
 from homeassistant.util import location
diff --git a/tests/common.py b/tests/common.py
index 436304b34ef..0751281874b 100644
--- a/tests/common.py
+++ b/tests/common.py
@@ -1,6 +1,6 @@
 """
-tests.helper
-~~~~~~~~~~~~~
+tests.common
+~~~~~~~~~~~~
 
 Helper method for writing tests.
 """
diff --git a/tests/components/automation/test_init.py b/tests/components/automation/test_init.py
index 3f6b0dab6f1..cf7a0567c25 100644
--- a/tests/components/automation/test_init.py
+++ b/tests/components/automation/test_init.py
@@ -1,6 +1,7 @@
 """
 tests.components.automation.test_init
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
 Tests automation component.
 """
 import unittest
diff --git a/tests/components/automation/test_numeric_state.py b/tests/components/automation/test_numeric_state.py
index 49246e48117..5d6a2c6596e 100644
--- a/tests/components/automation/test_numeric_state.py
+++ b/tests/components/automation/test_numeric_state.py
@@ -267,7 +267,7 @@ class TestAutomationNumericState(unittest.TestCase):
             }
         }))
         # 9 is below 10
-        self.hass.states.set('test.entity', 9, { 'test_attribute': 11 })
+        self.hass.states.set('test.entity', 9, {'test_attribute': 11})
         self.hass.pool.block_till_done()
         self.assertEqual(1, len(self.calls))
 
@@ -285,7 +285,7 @@ class TestAutomationNumericState(unittest.TestCase):
             }
         }))
         # 11 is not below 10
-        self.hass.states.set('test.entity', 11, { 'test_attribute': 9 })
+        self.hass.states.set('test.entity', 11, {'test_attribute': 9})
         self.hass.pool.block_till_done()
         self.assertEqual(0, len(self.calls))
 
@@ -304,7 +304,7 @@ class TestAutomationNumericState(unittest.TestCase):
             }
         }))
         # 9 is below 10
-        self.hass.states.set('test.entity', 'entity', { 'test_attribute': 9 })
+        self.hass.states.set('test.entity', 'entity', {'test_attribute': 9})
         self.hass.pool.block_till_done()
         self.assertEqual(1, len(self.calls))
 
@@ -323,7 +323,7 @@ class TestAutomationNumericState(unittest.TestCase):
             }
         }))
         # 11 is not below 10
-        self.hass.states.set('test.entity', 'entity', { 'test_attribute': 11 })
+        self.hass.states.set('test.entity', 'entity', {'test_attribute': 11})
         self.hass.pool.block_till_done()
         self.assertEqual(0, len(self.calls))
 
@@ -342,7 +342,7 @@ class TestAutomationNumericState(unittest.TestCase):
             }
         }))
         # 11 is not below 10, entity state value should not be tested
-        self.hass.states.set('test.entity', '9', { 'test_attribute': 11 })
+        self.hass.states.set('test.entity', '9', {'test_attribute': 11})
         self.hass.pool.block_till_done()
         self.assertEqual(0, len(self.calls))
 
@@ -380,7 +380,7 @@ class TestAutomationNumericState(unittest.TestCase):
             }
         }))
         # 9 is not below 10
-        self.hass.states.set('test.entity', 'entity', { 'test_attribute': 9, 'not_test_attribute': 11 })
+        self.hass.states.set('test.entity', 'entity', {'test_attribute': 9, 'not_test_attribute': 11})
         self.hass.pool.block_till_done()
         self.assertEqual(1, len(self.calls))
 
@@ -399,7 +399,7 @@ class TestAutomationNumericState(unittest.TestCase):
             }
         }))
         # 3 is below 10
-        self.hass.states.set('test.entity', 'entity', { 'test_attribute': [11, 15, 3] })
+        self.hass.states.set('test.entity', 'entity', {'test_attribute': [11, 15, 3]})
         self.hass.pool.block_till_done()
         self.assertEqual(1, len(self.calls))
 
@@ -418,7 +418,7 @@ class TestAutomationNumericState(unittest.TestCase):
             }
         }))
         # 9 is below 10
-        self.hass.states.set('test.entity', 'entity', { 'test_attribute': '0.9' })
+        self.hass.states.set('test.entity', 'entity', {'test_attribute': '0.9'})
         self.hass.pool.block_till_done()
         self.assertEqual(1, len(self.calls))
 
@@ -437,7 +437,7 @@ class TestAutomationNumericState(unittest.TestCase):
             }
         }))
         # 11 is not below 10
-        self.hass.states.set('test.entity', 'entity', { 'test_attribute': 11, 'not_test_attribute': 9  })
+        self.hass.states.set('test.entity', 'entity', {'test_attribute': 11, 'not_test_attribute': 9})
         self.hass.pool.block_till_done()
         self.assertEqual(0, len(self.calls))
 
diff --git a/tests/components/automation/test_state.py b/tests/components/automation/test_state.py
index a31f694f8c0..5e30f505092 100644
--- a/tests/components/automation/test_state.py
+++ b/tests/components/automation/test_state.py
@@ -1,6 +1,6 @@
 """
 tests.components.automation.test_state
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests state automation.
 """
diff --git a/tests/components/automation/test_template.py b/tests/components/automation/test_template.py
index 0c63d03d6c3..3ccd523af7b 100644
--- a/tests/components/automation/test_template.py
+++ b/tests/components/automation/test_template.py
@@ -1,6 +1,6 @@
 """
 tests.components.automation.test_template
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests template automation.
 """
diff --git a/tests/components/automation/test_zone.py b/tests/components/automation/test_zone.py
index bfb92bb0b1a..12bd35c8ae4 100644
--- a/tests/components/automation/test_zone.py
+++ b/tests/components/automation/test_zone.py
@@ -1,6 +1,6 @@
 """
-tests.components.automation.test_location
-±±±~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+tests.components.automation.test_zone
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests location automation.
 """
diff --git a/tests/components/binary_sensor/test_command_sensor.py b/tests/components/binary_sensor/test_command_sensor.py
index aa6a87c2061..20aca38e0e6 100644
--- a/tests/components/binary_sensor/test_command_sensor.py
+++ b/tests/components/binary_sensor/test_command_sensor.py
@@ -1,10 +1,9 @@
 """
 tests.components.binary_sensor.command_sensor
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests command binary sensor.
 """
-
 import unittest
 
 import homeassistant.core as ha
diff --git a/tests/components/device_tracker/test_init.py b/tests/components/device_tracker/test_init.py
index fb368bf863a..ac44be640ad 100644
--- a/tests/components/device_tracker/test_init.py
+++ b/tests/components/device_tracker/test_init.py
@@ -1,6 +1,6 @@
 """
-tests.test_component_device_tracker
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+tests.components.device_tracker.test_init
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests the device tracker compoments.
 """
diff --git a/tests/components/device_tracker/test_locative.py b/tests/components/device_tracker/test_locative.py
index cd02380d324..b64fbda8345 100644
--- a/tests/components/device_tracker/test_locative.py
+++ b/tests/components/device_tracker/test_locative.py
@@ -1,10 +1,9 @@
 """
-tests.components.device_tracker.locative
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+tests.components.device_tracker.test_locative
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests the locative device tracker component.
 """
-
 import unittest
 from unittest.mock import patch
 
@@ -24,7 +23,8 @@ hass = None
 
 def _url(data={}):
     """ Helper method to generate urls. """
-    data = "&".join(["{}={}".format(name, value) for name, value in data.items()])
+    data = "&".join(["{}={}".format(name, value) for
+                     name, value in data.items()])
     return "{}{}locative?{}".format(HTTP_BASE_URL, const.URL_API, data)
 
 
@@ -60,6 +60,7 @@ def tearDownModule():   # pylint: disable=invalid-name
     """ Stops the Home Assistant server. """
     hass.stop()
 
+
 # Stub out update_config or else Travis CI raises an exception
 @patch('homeassistant.components.device_tracker.update_config')
 class TestLocative(unittest.TestCase):
@@ -114,7 +115,6 @@ class TestLocative(unittest.TestCase):
         req = requests.get(_url(copy))
         self.assertEqual(422, req.status_code)
 
-
     def test_enter_and_exit(self, update_config):
         """ Test when there is a known zone """
         data = {
@@ -166,7 +166,6 @@ class TestLocative(unittest.TestCase):
         state_name = hass.states.get('{}.{}'.format('device_tracker', data['device'])).state
         self.assertEqual(state_name, 'work')
 
-
     def test_exit_after_enter(self, update_config):
         """ Test when an exit message comes after an enter message """
 
diff --git a/tests/components/device_tracker/test_mqtt.py b/tests/components/device_tracker/test_mqtt.py
index 6e219621a60..8a00ed7dae1 100644
--- a/tests/components/device_tracker/test_mqtt.py
+++ b/tests/components/device_tracker/test_mqtt.py
@@ -1,3 +1,9 @@
+"""
+tests.components.device_tracker.test_mqtt
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Tests the MQTT device tracker component.
+"""
 import unittest
 import os
 
diff --git a/tests/components/device_tracker/test_owntracks.py b/tests/components/device_tracker/test_owntracks.py
index c4d60d63693..ac9243ae5f8 100644
--- a/tests/components/device_tracker/test_owntracks.py
+++ b/tests/components/device_tracker/test_owntracks.py
@@ -1,8 +1,8 @@
 """
-tests.components.sensor.template
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+tests.components.device_tracker.test_owntracks
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-Tests template sensor.
+Tests Owntracks device tracker.
 """
 import json
 import os
@@ -111,14 +111,14 @@ class TestDeviceTrackerOwnTracks(unittest.TestCase):
             })
 
         self.hass.states.set(
-        'zone.passive', 'zoning',
-        {
-            'name': 'zone',
-            'latitude': 3.0,
-            'longitude': 1.0,
-            'radius': 10,
-            'passive': True
-        })
+            'zone.passive', 'zoning',
+            {
+                'name': 'zone',
+                'latitude': 3.0,
+                'longitude': 1.0,
+                'radius': 10,
+                'passive': True
+            })
         # Clear state between teste
         self.hass.states.set(DEVICE_TRACKER_STATE, None)
         owntracks.REGIONS_ENTERED = defaultdict(list)
diff --git a/tests/components/garage_door/test_demo.py b/tests/components/garage_door/test_demo.py
index 7c959709c48..781b47bb3d7 100644
--- a/tests/components/garage_door/test_demo.py
+++ b/tests/components/garage_door/test_demo.py
@@ -1,6 +1,6 @@
 """
 tests.components.garage_door.test_demo
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests demo garage door component.
 """
diff --git a/tests/components/light/test_init.py b/tests/components/light/test_init.py
index fcbe89ee27b..5830e371f6e 100644
--- a/tests/components/light/test_init.py
+++ b/tests/components/light/test_init.py
@@ -1,8 +1,8 @@
 """
-tests.test_component_switch
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+tests.components.test_init
+~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-Tests switch component.
+Tests light component.
 """
 # pylint: disable=too-many-public-methods,protected-access
 import unittest
@@ -18,7 +18,7 @@ from tests.common import mock_service, get_test_home_assistant
 
 
 class TestLight(unittest.TestCase):
-    """ Test the switch module. """
+    """ Test the light module. """
 
     def setUp(self):  # pylint: disable=invalid-name
         self.hass = get_test_home_assistant()
diff --git a/tests/components/light/test_mqtt.py b/tests/components/light/test_mqtt.py
index 552c4f1e028..834573b7c6e 100644
--- a/tests/components/light/test_mqtt.py
+++ b/tests/components/light/test_mqtt.py
@@ -1,6 +1,6 @@
 """
 tests.components.light.test_mqtt
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests mqtt light.
 
diff --git a/tests/components/media_player/test_demo.py b/tests/components/media_player/test_demo.py
index c19fd59e97f..c67d5d47623 100644
--- a/tests/components/media_player/test_demo.py
+++ b/tests/components/media_player/test_demo.py
@@ -6,13 +6,9 @@ Tests demo media_player component.
 """
 import unittest
 from unittest.mock import patch
-from pprint import pprint
 import homeassistant.core as ha
-from homeassistant.const import (
-    STATE_OFF, STATE_ON, STATE_UNKNOWN, STATE_PLAYING, STATE_PAUSED)
 import homeassistant.components.media_player as mp
 
-
 entity_id = 'media_player.walkman'
 
 
@@ -138,4 +134,3 @@ class TestDemoMediaPlayer(unittest.TestCase):
         mp.media_seek(self.hass, 100, ent_id)
         self.hass.pool.block_till_done()
         assert mock_seek.called
-
diff --git a/tests/components/notify/test_demo.py b/tests/components/notify/test_demo.py
index 182a2a38610..41b59e96e4f 100644
--- a/tests/components/notify/test_demo.py
+++ b/tests/components/notify/test_demo.py
@@ -1,7 +1,8 @@
 """
 tests.components.notify.test_demo
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Tests notify demo component
+
+Tests notify demo component.
 """
 import unittest
 
diff --git a/tests/components/rollershutter/test_mqtt.py b/tests/components/rollershutter/test_mqtt.py
index 261618a5e02..df206b3047d 100644
--- a/tests/components/rollershutter/test_mqtt.py
+++ b/tests/components/rollershutter/test_mqtt.py
@@ -1,6 +1,6 @@
 """
 tests.components.rollershutter.test_mqtt
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests MQTT rollershutter.
 """
diff --git a/tests/components/sensor/test_command_sensor.py b/tests/components/sensor/test_command_sensor.py
index ae6c9452d3f..0f4133ddb6e 100644
--- a/tests/components/sensor/test_command_sensor.py
+++ b/tests/components/sensor/test_command_sensor.py
@@ -1,10 +1,9 @@
 """
-tests.components.sensor.command_sensor
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+tests.components.sensor.test_command_sensor
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests command sensor.
 """
-
 import unittest
 
 import homeassistant.core as ha
@@ -12,7 +11,7 @@ from homeassistant.components.sensor import command_sensor
 
 
 class TestCommandSensorSensor(unittest.TestCase):
-    """ Test the Template sensor. """
+    """ Test the Command line sensor. """
 
     def setUp(self):
         self.hass = ha.HomeAssistant()
@@ -22,7 +21,7 @@ class TestCommandSensorSensor(unittest.TestCase):
         self.hass.stop()
 
     def test_setup(self):
-        """ Test sensor setup """
+        """ Test sensor setup. """
         config = {'name': 'Test',
                   'unit_of_measurement': 'in',
                   'command': 'echo 5'}
@@ -43,7 +42,7 @@ class TestCommandSensorSensor(unittest.TestCase):
         self.assertEqual('5', entity.state)
 
     def test_setup_bad_config(self):
-        """ Test setup with a bad config """
+        """ Test setup with a bad configuration. """
         config = {}
 
         devices = []
@@ -59,7 +58,7 @@ class TestCommandSensorSensor(unittest.TestCase):
         self.assertEqual(0, len(devices))
 
     def test_template(self):
-        """ Test command sensor with template """
+        """ Test command sensor with template. """
         data = command_sensor.CommandSensorData('echo 50')
 
         entity = command_sensor.CommandSensor(
@@ -68,7 +67,7 @@ class TestCommandSensorSensor(unittest.TestCase):
         self.assertEqual(5, float(entity.state))
 
     def test_bad_command(self):
-        """ Test bad command """
+        """ Test bad command. """
         data = command_sensor.CommandSensorData('asdfasdf')
         data.update()
 
diff --git a/tests/components/sensor/test_mfi.py b/tests/components/sensor/test_mfi.py
index bda8032fb49..9f8efcc6245 100644
--- a/tests/components/sensor/test_mfi.py
+++ b/tests/components/sensor/test_mfi.py
@@ -1,6 +1,6 @@
 """
 tests.components.sensor.test_mfi
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests mFi sensor.
 """
diff --git a/tests/components/sensor/test_mqtt.py b/tests/components/sensor/test_mqtt.py
index ce98a9399a5..81aeeae6d3c 100644
--- a/tests/components/sensor/test_mqtt.py
+++ b/tests/components/sensor/test_mqtt.py
@@ -2,7 +2,7 @@
 tests.components.sensor.test_mqtt
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-Tests mqtt sensor.
+Tests MQTT sensor.
 """
 import unittest
 
diff --git a/tests/components/sensor/test_template.py b/tests/components/sensor/test_template.py
index 96de2f6e875..26eb2c4b1a7 100644
--- a/tests/components/sensor/test_template.py
+++ b/tests/components/sensor/test_template.py
@@ -1,10 +1,9 @@
 """
-tests.components.sensor.template
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+tests.components.sensor.test_template
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests template sensor.
 """
-
 import homeassistant.core as ha
 import homeassistant.components.sensor as sensor
 
diff --git a/tests/components/sensor/test_yr.py b/tests/components/sensor/test_yr.py
index 59f2b6b676b..c4979720a58 100644
--- a/tests/components/sensor/test_yr.py
+++ b/tests/components/sensor/test_yr.py
@@ -1,6 +1,6 @@
 """
 tests.components.sensor.test_yr
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests Yr sensor.
 """
@@ -73,7 +73,7 @@ class TestSensorYr:
         assert '1025.1' == state.state
 
         state = self.hass.states.get('sensor.yr_wind_direction')
-        assert '°'== state.attributes.get('unit_of_measurement')
+        assert '°' == state.attributes.get('unit_of_measurement')
         assert '81.8' == state.state
 
         state = self.hass.states.get('sensor.yr_humidity')
diff --git a/tests/components/switch/test_command_switch.py b/tests/components/switch/test_command_switch.py
index 3684f78fff4..43055413e09 100644
--- a/tests/components/switch/test_command_switch.py
+++ b/tests/components/switch/test_command_switch.py
@@ -1,6 +1,6 @@
 """
 tests.components.switch.test_command_switch
-~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests command switch.
 """
@@ -55,7 +55,6 @@ class TestCommandSwitch(unittest.TestCase):
             state = self.hass.states.get('switch.test')
             self.assertEqual(STATE_OFF, state.state)
 
-
     def test_state_value(self):
         with tempfile.TemporaryDirectory() as tempdirname:
             path = os.path.join(tempdirname, 'switch_status')
@@ -79,7 +78,7 @@ class TestCommandSwitch(unittest.TestCase):
 
             switch.turn_on(self.hass, 'switch.test')
             self.hass.pool.block_till_done()
-        
+
             state = self.hass.states.get('switch.test')
             self.assertEqual(STATE_ON, state.state)
 
@@ -89,7 +88,6 @@ class TestCommandSwitch(unittest.TestCase):
             state = self.hass.states.get('switch.test')
             self.assertEqual(STATE_OFF, state.state)
 
-
     def test_state_json_value(self):
         with tempfile.TemporaryDirectory() as tempdirname:
             path = os.path.join(tempdirname, 'switch_status')
diff --git a/tests/components/switch/test_init.py b/tests/components/switch/test_init.py
index dc7129ca541..6860ca85c3b 100644
--- a/tests/components/switch/test_init.py
+++ b/tests/components/switch/test_init.py
@@ -1,6 +1,6 @@
 """
-tests.test_component_switch
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+tests.components.switch.test_init
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests switch component.
 """
diff --git a/tests/components/switch/test_mfi.py b/tests/components/switch/test_mfi.py
index 8201152352c..0f763dc3392 100644
--- a/tests/components/switch/test_mfi.py
+++ b/tests/components/switch/test_mfi.py
@@ -1,6 +1,6 @@
 """
 tests.components.switch.test_mfi
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests mFi switch.
 """
diff --git a/tests/components/switch/test_mqtt.py b/tests/components/switch/test_mqtt.py
index b7c20e5ff94..e5058f7826e 100644
--- a/tests/components/switch/test_mqtt.py
+++ b/tests/components/switch/test_mqtt.py
@@ -2,7 +2,7 @@
 tests.components.switch.test_mqtt
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-Tests mqtt switch.
+Tests MQTT switch.
 """
 import unittest
 
@@ -107,4 +107,4 @@ class TestSensorMQTT(unittest.TestCase):
         self.hass.pool.block_till_done()
 
         state = self.hass.states.get('switch.test')
-        self.assertEqual(STATE_OFF, state.state)
\ No newline at end of file
+        self.assertEqual(STATE_OFF, state.state)
diff --git a/tests/components/switch/test_template.py b/tests/components/switch/test_template.py
index aeffe9ff194..e4bd20b27cb 100644
--- a/tests/components/switch/test_template.py
+++ b/tests/components/switch/test_template.py
@@ -1,10 +1,9 @@
 """
 tests.components.switch.template
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests template switch.
 """
-
 import homeassistant.core as ha
 import homeassistant.components as core
 import homeassistant.components.switch as switch
@@ -27,7 +26,6 @@ class TestTemplateSwitch:
 
         self.hass.services.register('test', 'automation', record_call)
 
-
     def teardown_method(self, method):
         """ Stop down stuff we started. """
         self.hass.stop()
@@ -53,7 +51,6 @@ class TestTemplateSwitch:
             }
         })
 
-
         state = self.hass.states.set('switch.test_state', STATE_ON)
         self.hass.pool.block_till_done()
 
@@ -66,7 +63,6 @@ class TestTemplateSwitch:
         state = self.hass.states.get('switch.test_template_switch')
         assert state.state == STATE_OFF
 
-
     def test_template_state_boolean_on(self):
         assert switch.setup(self.hass, {
             'switch': {
@@ -278,7 +274,6 @@ class TestTemplateSwitch:
 
         assert 1 == len(self.calls)
 
-
     def test_off_action(self):
         assert switch.setup(self.hass, {
             'switch': {
diff --git a/tests/components/test_alexa.py b/tests/components/test_alexa.py
index 42acf5b3f62..60dbcbb0157 100644
--- a/tests/components/test_alexa.py
+++ b/tests/components/test_alexa.py
@@ -1,6 +1,6 @@
 """
-tests.test_component_alexa
-~~~~~~~~~~~~~~~~~~~~~~~~~~
+tests.components.test_alexa
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests Home Assistant Alexa component does what it should do.
 """
@@ -33,7 +33,7 @@ calls = []
 @patch('homeassistant.components.http.util.get_local_ip',
        return_value='127.0.0.1')
 def setUpModule(mock_get_local_ip):   # pylint: disable=invalid-name
-    """Initalize a Home Assistant server for testing this module."""
+    """ Initalize a Home Assistant server for testing this module. """
     global hass
 
     hass = ha.HomeAssistant()
diff --git a/tests/components/test_api.py b/tests/components/test_api.py
index 17cfd24f832..e2e6341c4d6 100644
--- a/tests/components/test_api.py
+++ b/tests/components/test_api.py
@@ -1,6 +1,6 @@
 """
-tests.test_component_http
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
+tests.components.test_api
+~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests Home Assistant HTTP component does what it should do.
 """
diff --git a/tests/components/test_configurator.py b/tests/components/test_configurator.py
index f41a5319ffd..4e2f30f6c32 100644
--- a/tests/components/test_configurator.py
+++ b/tests/components/test_configurator.py
@@ -1,6 +1,6 @@
 """
-tests.test_component_configurator
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+tests.components.test_configurator
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests Configurator component.
 """
diff --git a/tests/components/test_conversation.py b/tests/components/test_conversation.py
index 243fe128b28..2b41349c126 100644
--- a/tests/components/test_conversation.py
+++ b/tests/components/test_conversation.py
@@ -1,6 +1,6 @@
 """
 tests.components.test_conversation
-~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests Conversation component.
 """
diff --git a/tests/components/test_demo.py b/tests/components/test_demo.py
index 13cc55ed7dc..39418852597 100644
--- a/tests/components/test_demo.py
+++ b/tests/components/test_demo.py
@@ -1,6 +1,6 @@
 """
 tests.test_component_demo
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests demo component.
 """
diff --git a/tests/components/test_device_sun_light_trigger.py b/tests/components/test_device_sun_light_trigger.py
index f3ec23a96bf..586d67c2f70 100644
--- a/tests/components/test_device_sun_light_trigger.py
+++ b/tests/components/test_device_sun_light_trigger.py
@@ -1,6 +1,6 @@
 """
 tests.test_component_device_sun_light_trigger
-~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests device sun light trigger component.
 """
diff --git a/tests/components/test_frontend.py b/tests/components/test_frontend.py
index e8c0c53d13e..0f4a2dc4134 100644
--- a/tests/components/test_frontend.py
+++ b/tests/components/test_frontend.py
@@ -1,6 +1,6 @@
 """
 tests.test_component_http
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests Home Assistant HTTP component does what it should do.
 """
diff --git a/tests/components/test_graphite.py b/tests/components/test_graphite.py
index 720da54930f..c0ca228efe2 100644
--- a/tests/components/test_graphite.py
+++ b/tests/components/test_graphite.py
@@ -1,6 +1,6 @@
 """
 tests.components.test_graphite
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests graphite feeder.
 """
diff --git a/tests/components/test_group.py b/tests/components/test_group.py
index d70828852e4..2301a15f59e 100644
--- a/tests/components/test_group.py
+++ b/tests/components/test_group.py
@@ -1,6 +1,6 @@
 """
 tests.test_component_group
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests the group compoments.
 """
diff --git a/tests/components/test_history.py b/tests/components/test_history.py
index f9b8e94d286..db0c154283d 100644
--- a/tests/components/test_history.py
+++ b/tests/components/test_history.py
@@ -1,6 +1,6 @@
 """
-tests.test_component_history
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+tests.components.test_history
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests the history component.
 """
diff --git a/tests/components/test_influx.py b/tests/components/test_influx.py
index 365b788da0d..d9bc00b4f60 100644
--- a/tests/components/test_influx.py
+++ b/tests/components/test_influx.py
@@ -1,6 +1,6 @@
 """
 tests.components.test_influxdb
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests influxdb component.
 """
diff --git a/tests/components/test_init.py b/tests/components/test_init.py
index 723149b19c6..51d84aab731 100644
--- a/tests/components/test_init.py
+++ b/tests/components/test_init.py
@@ -1,6 +1,6 @@
 """
-tests.test_component_core
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
+tests.components.test_init
+~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests core compoments.
 """
diff --git a/tests/components/test_introduction.py b/tests/components/test_introduction.py
index 42c16081d1e..4c7d104ba49 100644
--- a/tests/components/test_introduction.py
+++ b/tests/components/test_introduction.py
@@ -1,12 +1,9 @@
 """
-tests.components.introduction
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+tests.components.test_introduction
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Test introduction.
-
-This test is primarily to ensure that default components don't crash HASS.
 """
-
 import unittest
 
 import homeassistant.core as ha
diff --git a/tests/components/test_logbook.py b/tests/components/test_logbook.py
index d2879b1f308..b6bc764660d 100644
--- a/tests/components/test_logbook.py
+++ b/tests/components/test_logbook.py
@@ -1,6 +1,6 @@
 """
-tests.test_component_logbook
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+tests.components.test_logbook
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests the logbook component.
 """
diff --git a/tests/components/test_logger.py b/tests/components/test_logger.py
index 5e3aeda88d3..2be5ca5c740 100644
--- a/tests/components/test_logger.py
+++ b/tests/components/test_logger.py
@@ -1,6 +1,6 @@
 """
-tests.test_logger
-~~~~~~~~~~~~~~~~~~
+tests.components.test_logger
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests logger component.
 """
diff --git a/tests/components/test_mqtt.py b/tests/components/test_mqtt.py
index 1a33eb6276b..9ca51c687bc 100644
--- a/tests/components/test_mqtt.py
+++ b/tests/components/test_mqtt.py
@@ -1,6 +1,6 @@
 """
-tests.test_component_mqtt
-~~~~~~~~~~~~~~~~~~~~~~~~~
+tests.components.test_mqtt
+~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests MQTT component.
 """
@@ -63,10 +63,12 @@ class TestMQTT(unittest.TestCase):
         self.hass.pool.block_till_done()
 
         self.assertEqual(1, len(self.calls))
-        self.assertEqual('test-topic',
-                         self.calls[0][0].data['service_data'][mqtt.ATTR_TOPIC])
-        self.assertEqual('test-payload',
-                         self.calls[0][0].data['service_data'][mqtt.ATTR_PAYLOAD])
+        self.assertEqual(
+                'test-topic',
+                self.calls[0][0].data['service_data'][mqtt.ATTR_TOPIC])
+        self.assertEqual(
+                'test-payload',
+                self.calls[0][0].data['service_data'][mqtt.ATTR_PAYLOAD])
 
     def test_service_call_without_topic_does_not_publish(self):
         self.hass.bus.fire(EVENT_CALL_SERVICE, {
diff --git a/tests/components/test_mqtt_eventstream.py b/tests/components/test_mqtt_eventstream.py
index 5e1680ad2a4..269b672055e 100644
--- a/tests/components/test_mqtt_eventstream.py
+++ b/tests/components/test_mqtt_eventstream.py
@@ -1,6 +1,6 @@
 """
-tests.test_component_mqtt_eventstream
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+tests.components.test_mqtt_eventstream
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests MQTT eventstream component.
 """
diff --git a/tests/components/test_proximity.py b/tests/components/test_proximity.py
index feca18a7a4e..c66b34a0acf 100644
--- a/tests/components/test_proximity.py
+++ b/tests/components/test_proximity.py
@@ -1,13 +1,13 @@
 """
-tests.components.proximity
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+tests.components.test_proximity
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests proximity component.
 """
-
 import homeassistant.core as ha
 from homeassistant.components import proximity
 
+
 class TestProximity:
     """ Test the Proximity component. """
 
@@ -25,7 +25,7 @@ class TestProximity:
     def teardown_method(self, method):
         """ Stop down stuff we started. """
         self.hass.stop()
-        
+
     def test_proximity(self):
         assert proximity.setup(self.hass, {
             'proximity': {
@@ -45,12 +45,12 @@ class TestProximity:
         assert state.state == 'not set'
         assert state.attributes.get('nearest') == 'not set'
         assert state.attributes.get('dir_of_travel') == 'not set'
-        
+
         self.hass.states.set('proximity.home', '0')
         self.hass.pool.block_till_done()
         state = self.hass.states.get('proximity.home')
         assert state.state == '0'
-        
+
     def test_no_devices_in_config(self):
         assert not proximity.setup(self.hass, {
             'proximity': {
@@ -61,7 +61,7 @@ class TestProximity:
                 'tolerance': '1'
             }
         })
-        
+
     def test_no_tolerance_in_config(self):
         assert proximity.setup(self.hass, {
             'proximity': {
@@ -75,7 +75,7 @@ class TestProximity:
                 }
             }
         })
-        
+
     def test_no_ignored_zones_in_config(self):
         assert proximity.setup(self.hass, {
             'proximity': {
@@ -87,7 +87,7 @@ class TestProximity:
                 'tolerance': '1'
             }
         })
-     
+
     def test_no_zone_in_config(self):
         assert proximity.setup(self.hass, {
             'proximity': {
@@ -100,8 +100,8 @@ class TestProximity:
                 },
                 'tolerance': '1'
             }
-        })     
-    
+        })
+
     def test_device_tracker_test1_in_zone(self):
         assert proximity.setup(self.hass, {
             'proximity': {
@@ -115,7 +115,7 @@ class TestProximity:
                 'tolerance': '1'
             }
         })
-        
+
         self.hass.states.set(
             'device_tracker.test1', 'home',
             {
@@ -128,7 +128,7 @@ class TestProximity:
         assert state.state == '0'
         assert state.attributes.get('nearest') == 'test1'
         assert state.attributes.get('dir_of_travel') == 'arrived'
-        
+
     def test_device_trackers_in_zone(self):
         assert proximity.setup(self.hass, {
             'proximity': {
@@ -143,7 +143,7 @@ class TestProximity:
                 'tolerance': '1'
             }
         })
-        
+
         self.hass.states.set(
             'device_tracker.test1', 'home',
             {
@@ -164,7 +164,7 @@ class TestProximity:
         assert state.state == '0'
         assert (state.attributes.get('nearest') == 'test1, test2') or (state.attributes.get('nearest') == 'test2, test1')
         assert state.attributes.get('dir_of_travel') == 'arrived'
-        
+
     def test_device_tracker_test1_away(self):
         assert proximity.setup(self.hass, {
             'proximity': {
@@ -178,7 +178,7 @@ class TestProximity:
                 'tolerance': '1'
             }
         })
-        
+
         self.hass.states.set(
             'device_tracker.test1', 'not_home',
             {
@@ -190,7 +190,7 @@ class TestProximity:
         state = self.hass.states.get('proximity.home')
         assert state.attributes.get('nearest') == 'test1'
         assert state.attributes.get('dir_of_travel') == 'unknown'
-        
+
     def test_device_tracker_test1_awayfurther(self):
         assert proximity.setup(self.hass, {
             'proximity': {
@@ -203,7 +203,7 @@ class TestProximity:
                 }
             }
         })
-        
+
         self.hass.states.set(
             'device_tracker.test1', 'not_home',
             {
@@ -226,7 +226,7 @@ class TestProximity:
         state = self.hass.states.get('proximity.home')
         assert state.attributes.get('nearest') == 'test1'
         assert state.attributes.get('dir_of_travel') == 'away_from'
-        
+
     def test_device_tracker_test1_awaycloser(self):
         assert proximity.setup(self.hass, {
             'proximity': {
@@ -239,7 +239,7 @@ class TestProximity:
                 }
             }
         })
-        
+
         self.hass.states.set(
             'device_tracker.test1', 'not_home',
             {
@@ -262,7 +262,7 @@ class TestProximity:
         state = self.hass.states.get('proximity.home')
         assert state.attributes.get('nearest') == 'test1'
         assert state.attributes.get('dir_of_travel') == 'towards'
-        
+
     def test_all_device_trackers_in_ignored_zone(self):
         assert proximity.setup(self.hass, {
             'proximity': {
@@ -275,7 +275,7 @@ class TestProximity:
                 }
             }
         })
-        
+
         self.hass.states.set(
             'device_tracker.test1', 'work',
             {
@@ -286,7 +286,7 @@ class TestProximity:
         assert state.state == 'not set'
         assert state.attributes.get('nearest') == 'not set'
         assert state.attributes.get('dir_of_travel') == 'not set'
-        
+
     def test_device_tracker_test1_no_coordinates(self):
         assert proximity.setup(self.hass, {
             'proximity': {
@@ -300,7 +300,7 @@ class TestProximity:
                 'tolerance': '1'
             }
         })
-        
+
         self.hass.states.set(
             'device_tracker.test1', 'not_home',
             {
@@ -310,7 +310,7 @@ class TestProximity:
         state = self.hass.states.get('proximity.home')
         assert state.attributes.get('nearest') == 'not set'
         assert state.attributes.get('dir_of_travel') == 'not set'
-        
+
     def test_device_tracker_test1_awayfurther_than_test2_first_test1(self):
         self.hass.states.set(
             'device_tracker.test1', 'not_home',
@@ -336,7 +336,7 @@ class TestProximity:
                 }
             }
         })
-        
+
         self.hass.states.set(
             'device_tracker.test1', 'not_home',
             {
@@ -359,7 +359,7 @@ class TestProximity:
         state = self.hass.states.get('proximity.home')
         assert state.attributes.get('nearest') == 'test1'
         assert state.attributes.get('dir_of_travel') == 'unknown'
-        
+
     def test_device_tracker_test1_awayfurther_than_test2_first_test2(self):
         self.hass.states.set(
             'device_tracker.test1', 'not_home',
@@ -385,7 +385,7 @@ class TestProximity:
                 }
             }
         })
-        
+
         self.hass.states.set(
             'device_tracker.test2', 'not_home',
             {
@@ -408,7 +408,7 @@ class TestProximity:
         state = self.hass.states.get('proximity.home')
         assert state.attributes.get('nearest') == 'test1'
         assert state.attributes.get('dir_of_travel') == 'unknown'
-        
+
     def test_device_tracker_test1_awayfurther_test2_in_ignored_zone(self):
         self.hass.states.set(
             'device_tracker.test1', 'not_home',
@@ -434,7 +434,7 @@ class TestProximity:
                 }
             }
         })
-        
+
         self.hass.states.set(
             'device_tracker.test1', 'not_home',
             {
@@ -446,7 +446,7 @@ class TestProximity:
         state = self.hass.states.get('proximity.home')
         assert state.attributes.get('nearest') == 'test1'
         assert state.attributes.get('dir_of_travel') == 'unknown'
-        
+
     def test_device_tracker_test1_awayfurther_than_test2_first_test1_than_test2_than_test1(self):
         self.hass.states.set(
             'device_tracker.test1', 'not_home',
@@ -472,7 +472,7 @@ class TestProximity:
                 }
             }
         })
-        
+
         self.hass.states.set(
             'device_tracker.test1', 'not_home',
             {
@@ -481,7 +481,7 @@ class TestProximity:
                 'longitude': 5.1
             })
         self.hass.pool.block_till_done()
-        
+
         self.hass.states.set(
             'device_tracker.test2', 'not_home',
             {
@@ -515,7 +515,7 @@ class TestProximity:
         state = self.hass.states.get('proximity.home')
         assert state.attributes.get('nearest') == 'test2'
         assert state.attributes.get('dir_of_travel') == 'unknown'
-        
+
     def test_device_tracker_test1_awayfurther_a_bit(self):
         assert proximity.setup(self.hass, {
             'proximity': {
@@ -529,7 +529,7 @@ class TestProximity:
                 'tolerance': 1000
             }
         })
-        
+
         self.hass.states.set(
             'device_tracker.test1', 'not_home',
             {
@@ -552,7 +552,7 @@ class TestProximity:
         state = self.hass.states.get('proximity.home')
         assert state.attributes.get('nearest') == 'test1'
         assert state.attributes.get('dir_of_travel') == 'stationary'
-    
+
     def test_device_tracker_test1_nearest_after_test2_in_ignored_zone(self):
         self.hass.states.set(
             'device_tracker.test1', 'not_home',
@@ -578,7 +578,7 @@ class TestProximity:
                 }
             }
         })
-        
+
         self.hass.states.set(
             'device_tracker.test1', 'not_home',
             {
@@ -590,7 +590,7 @@ class TestProximity:
         state = self.hass.states.get('proximity.home')
         assert state.attributes.get('nearest') == 'test1'
         assert state.attributes.get('dir_of_travel') == 'unknown'
-        
+
         self.hass.states.set(
             'device_tracker.test2', 'not_home',
             {
@@ -602,7 +602,7 @@ class TestProximity:
         state = self.hass.states.get('proximity.home')
         assert state.attributes.get('nearest') == 'test2'
         assert state.attributes.get('dir_of_travel') == 'unknown'
-        
+
         self.hass.states.set(
             'device_tracker.test2', 'work',
             {
diff --git a/tests/components/test_recorder.py b/tests/components/test_recorder.py
index 26e5fdfd6b7..0d42da865a0 100644
--- a/tests/components/test_recorder.py
+++ b/tests/components/test_recorder.py
@@ -1,5 +1,5 @@
 """
-tests.test_component_recorder
+tests.components.test_recorder
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests Recorder component.
diff --git a/tests/components/test_shell_command.py b/tests/components/test_shell_command.py
index eefbdc5b230..6fdc671f5ad 100644
--- a/tests/components/test_shell_command.py
+++ b/tests/components/test_shell_command.py
@@ -1,8 +1,8 @@
 """
-tests.test_shell_command
-~~~~~~~~~~~~~~~~~~~~~~~~
+tests.components.test_shell_command
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-Tests demo component.
+Tests Shell command component.
 """
 import os
 import tempfile
diff --git a/tests/components/test_splunk.py b/tests/components/test_splunk.py
index 05c020c88ed..811878d537b 100644
--- a/tests/components/test_splunk.py
+++ b/tests/components/test_splunk.py
@@ -1,6 +1,6 @@
 """
 tests.components.test_splunk
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests splunk component.
 """
@@ -40,7 +40,6 @@ class TestSplunk(unittest.TestCase):
         self.assertEqual(EVENT_STATE_CHANGED,
                          hass.bus.listen.call_args_list[0][0][0])
 
-
     def _setup(self, mock_requests):
         self.mock_post = mock_requests.post
         self.mock_request_exception = Exception
diff --git a/tests/components/test_statsd.py b/tests/components/test_statsd.py
index 72c61a22f54..a793e519a2e 100644
--- a/tests/components/test_statsd.py
+++ b/tests/components/test_statsd.py
@@ -1,8 +1,8 @@
 """
 tests.components.test_statsd
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-Tests statsd feeder.
+Tests StatsD feeder.
 """
 import unittest
 from unittest import mock
diff --git a/tests/components/test_sun.py b/tests/components/test_sun.py
index 366b483d3ff..44f428dc9a0 100644
--- a/tests/components/test_sun.py
+++ b/tests/components/test_sun.py
@@ -1,6 +1,6 @@
 """
-tests.test_component_sun
-~~~~~~~~~~~~~~~~~~~~~~~~~~
+tests.components.test_sun
+~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests Sun component.
 """
diff --git a/tests/components/test_updater.py b/tests/components/test_updater.py
index 3e5cf55e0b0..e1e2f5a7950 100644
--- a/tests/components/test_updater.py
+++ b/tests/components/test_updater.py
@@ -1,6 +1,6 @@
 """
-tests.test_updater
-~~~~~~~~~~~~~~~~~~
+tests.components.test_updater
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests updater component.
 """
diff --git a/tests/components/test_weblink.py b/tests/components/test_weblink.py
index 6a8354c549c..f93a6ba0840 100644
--- a/tests/components/test_weblink.py
+++ b/tests/components/test_weblink.py
@@ -1,4 +1,9 @@
-# -*- coding: utf-8 -*-
+"""
+tests.components.test_weblink
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Tests weblink component.
+"""
 import unittest
 
 import homeassistant.core as ha
diff --git a/tests/components/test_zone.py b/tests/components/test_zone.py
index df27bcf1fe5..12f9a04792f 100644
--- a/tests/components/test_zone.py
+++ b/tests/components/test_zone.py
@@ -1,6 +1,6 @@
 """
 tests.components.test_zone
-±±±~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests zone component.
 """
diff --git a/tests/components/thermostat/test_heat_control.py b/tests/components/thermostat/test_heat_control.py
index 4ec305574e2..aa5a43c9c0e 100644
--- a/tests/components/thermostat/test_heat_control.py
+++ b/tests/components/thermostat/test_heat_control.py
@@ -15,7 +15,7 @@ from homeassistant.const import (
     TEMP_CELCIUS,
 )
 import homeassistant.core as ha
-from homeassistant.components import switch, thermostat
+from homeassistant.components import thermostat
 
 
 entity = 'thermostat.test'
@@ -138,4 +138,3 @@ class TestThermostatHeatControl(unittest.TestCase):
 
         self.hass.services.register('switch', SERVICE_TURN_ON, log_call)
         self.hass.services.register('switch', SERVICE_TURN_OFF, log_call)
-
diff --git a/tests/config/custom_components/device_tracker/test.py b/tests/config/custom_components/device_tracker/test.py
index 635d400316f..11c0a090420 100644
--- a/tests/config/custom_components/device_tracker/test.py
+++ b/tests/config/custom_components/device_tracker/test.py
@@ -1,6 +1,6 @@
 """
-custom_components.device_tracker.test
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+config.custom_components.device_tracker.test
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Provides a mock device scanner.
 """
diff --git a/tests/config/custom_components/light/test.py b/tests/config/custom_components/light/test.py
index 1512d080b05..6999f2436ca 100644
--- a/tests/config/custom_components/light/test.py
+++ b/tests/config/custom_components/light/test.py
@@ -1,6 +1,6 @@
 """
-custom_components.light.test
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+config.custom_components.light.test
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Provides a mock switch platform.
 
diff --git a/tests/config/custom_components/switch/test.py b/tests/config/custom_components/switch/test.py
index bb95154a94b..5d3c2585e5d 100644
--- a/tests/config/custom_components/switch/test.py
+++ b/tests/config/custom_components/switch/test.py
@@ -1,6 +1,6 @@
 """
-custom_components.switch.test
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+config.custom_components.switch.test
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Provides a mock switch platform.
 
diff --git a/tests/helpers/test_entity.py b/tests/helpers/test_entity.py
index 8845bb622dc..37661623880 100644
--- a/tests/helpers/test_entity.py
+++ b/tests/helpers/test_entity.py
@@ -1,6 +1,6 @@
 """
-tests.test_helper_entity
-~~~~~~~~~~~~~~~~~~~~~~~~
+tests.helpers.test_entity
+~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests the entity helper.
 """
diff --git a/tests/helpers/test_entity_component.py b/tests/helpers/test_entity_component.py
index 68aecd32f5b..6bd1a4e22f0 100644
--- a/tests/helpers/test_entity_component.py
+++ b/tests/helpers/test_entity_component.py
@@ -1,6 +1,6 @@
 """
-tests.test_helper_entity_component
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+tests.helpers.test_entity_component
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests the entity component helper.
 """
diff --git a/tests/helpers/test_event.py b/tests/helpers/test_event.py
index aef7b834016..e1c17ba6c06 100644
--- a/tests/helpers/test_event.py
+++ b/tests/helpers/test_event.py
@@ -1,6 +1,6 @@
 """
 tests.helpers.event_test
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests event helpers.
 """
diff --git a/tests/helpers/test_event_decorators.py b/tests/helpers/test_event_decorators.py
index db836e372ae..1ef8c042e69 100644
--- a/tests/helpers/test_event_decorators.py
+++ b/tests/helpers/test_event_decorators.py
@@ -1,6 +1,6 @@
 """
 tests.helpers.test_event_decorators
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests event decorator helpers.
 """
diff --git a/tests/helpers/test_init.py b/tests/helpers/test_init.py
index 9d8afeb2b6d..fc6ec914046 100644
--- a/tests/helpers/test_init.py
+++ b/tests/helpers/test_init.py
@@ -1,6 +1,6 @@
 """
-tests.test_helpers
-~~~~~~~~~~~~~~~~~~~~
+tests.helpers.test_init
+~~~~~~~~~~~~~~~~~~~~~~~
 
 Tests component helpers.
 """
diff --git a/tests/helpers/test_service.py b/tests/helpers/test_service.py
index de730e7e919..73081a7da7e 100644
--- a/tests/helpers/test_service.py
+++ b/tests/helpers/test_service.py
@@ -15,9 +15,7 @@ from tests.common import get_test_home_assistant, mock_service
 
 
 class TestServiceHelpers(unittest.TestCase):
-    """
-    Tests the Home Assistant service helpers.
-    """
+    """ Tests the Home Assistant service helpers. """
 
     def setUp(self):     # pylint: disable=invalid-name
         """ things to be run when tests are started. """
diff --git a/tests/helpers/test_state.py b/tests/helpers/test_state.py
index e222e72fe4b..3924bd0489e 100644
--- a/tests/helpers/test_state.py
+++ b/tests/helpers/test_state.py
@@ -24,12 +24,10 @@ from tests.common import get_test_home_assistant, mock_service
 
 
 class TestStateHelpers(unittest.TestCase):
-    """
-    Tests the Home Assistant event helpers.
-    """
+    """ Tests the Home Assistant event helpers. """
 
     def setUp(self):     # pylint: disable=invalid-name
-        """ things to be run when tests are started. """
+        """ Things to be run when tests are started. """
         self.hass = get_test_home_assistant()
         core_components.setup(self.hass, {})
 
@@ -166,9 +164,9 @@ class TestStateHelpers(unittest.TestCase):
 
     def test_as_number_coercion(self):
         for _state in ('0', '0.0'):
-            self.assertEqual(
-                0.0, float(state.state_as_number(
-                ha.State('domain.test', _state, {}))))
+            self.assertEqual(0.0, float(
+                    state.state_as_number(
+                    ha.State('domain.test', _state, {}))))
         for _state in ('1', '1.0'):
             self.assertEqual(
                 1.0, float(state.state_as_number(
diff --git a/tests/test_config.py b/tests/test_config.py
index 94557eda16e..87f0c4e5b03 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -1,6 +1,6 @@
 """
 tests.test_config
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~
 
 Tests config utils.
 """
@@ -102,7 +102,6 @@ class TestConfig(unittest.TestCase):
         with self.assertRaises(HomeAssistantError):
             config_util.load_yaml_config_file(YAML_PATH)
 
-
     def test_load_yaml_config_preserves_key_order(self):
         with open(YAML_PATH, 'w') as f:
             f.write('hello: 0\n')
diff --git a/tests/test_core.py b/tests/test_core.py
index 0fbf0b0bdd9..6a19a2aa7e8 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -1,6 +1,6 @@
 """
 tests.test_core
-~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~
 
 Provides tests to verify that Home Assistant core works.
 """
diff --git a/tests/test_loader.py b/tests/test_loader.py
index 124a5c87d16..7651cdee649 100644
--- a/tests/test_loader.py
+++ b/tests/test_loader.py
@@ -1,6 +1,6 @@
 """
-ha_tests.test_loader
-~~~~~~~~~~~~~~~~~~~~~~
+tests.test_loader
+~~~~~~~~~~~~~~~~~
 
 Provides tests to verify that we can load components.
 """
diff --git a/tests/test_remote.py b/tests/test_remote.py
index 31ccad8f7aa..777f1c30e84 100644
--- a/tests/test_remote.py
+++ b/tests/test_remote.py
@@ -1,6 +1,6 @@
 """
 tests.remote
-~~~~~~~~~~~~~~
+~~~~~~~~~~~~
 
 Tests Home Assistant remote methods and classes.
 Uses port 8122 for master, 8123 for slave
diff --git a/tests/util/test_color.py b/tests/util/test_color.py
index 4b4a70ebe9c..79bbcc01495 100644
--- a/tests/util/test_color.py
+++ b/tests/util/test_color.py
@@ -1,4 +1,7 @@
 """
+tests.util.test_color
+~~~~~~~~~~~~~~~~~~~~~
+
 Tests Home Assistant color util methods.
 """
 import unittest
diff --git a/tests/util/test_dt.py b/tests/util/test_dt.py
index 5deafb58040..78e77d8f14e 100644
--- a/tests/util/test_dt.py
+++ b/tests/util/test_dt.py
@@ -1,6 +1,6 @@
 """
-tests.test_util
-~~~~~~~~~~~~~~~~~
+tests.util.test_dt
+~~~~~~~~~~~~~~~~~~
 
 Tests Home Assistant date util methods.
 """
diff --git a/tests/util/test_init.py b/tests/util/test_init.py
index f0a3eb8a109..bd546d4e5e1 100644
--- a/tests/util/test_init.py
+++ b/tests/util/test_init.py
@@ -1,6 +1,6 @@
 """
-tests.test_util
-~~~~~~~~~~~~~~~~~
+tests.util.test_init
+~~~~~~~~~~~~~~~~~~~~
 
 Tests Home Assistant util methods.
 """
diff --git a/tests/util/test_package.py b/tests/util/test_package.py
index db5a8a88e94..f17eb681c08 100644
--- a/tests/util/test_package.py
+++ b/tests/util/test_package.py
@@ -1,4 +1,7 @@
 """
+tests.util.test_packages
+~~~~~~~~~~~~~~~~~~~~~~~~
+
 Tests Home Assistant package util methods.
 """
 import os
@@ -18,26 +21,26 @@ TEST_ZIP_REQ = 'file://{}#{}' \
 
 
 class TestPackageUtil(unittest.TestCase):
-    """ Tests for homeassistant.util.package module """
+    """ Tests for homeassistant.util.package module. """
 
     def setUp(self):
-        """ Create local library for testing """
+        """ Create local library for testing. """
         self.tmp_dir = tempfile.TemporaryDirectory()
         self.lib_dir = os.path.join(self.tmp_dir.name, 'lib')
 
     def tearDown(self):
-        """ Remove local library """
+        """ Remove local library. """
         self.tmp_dir.cleanup()
 
     def test_install_existing_package(self):
-        """ Test an install attempt on an existing package """
+        """ Test an install attempt on an existing package. """
         self.assertTrue(package.check_package_exists(
             TEST_EXIST_REQ, self.lib_dir))
 
         self.assertTrue(package.install_package(TEST_EXIST_REQ))
 
     def test_install_package_zip(self):
-        """ Test an install attempt from a zip path """
+        """ Test an install attempt from a zip path. """
         self.assertFalse(package.check_package_exists(
             TEST_ZIP_REQ, self.lib_dir))
         self.assertFalse(package.check_package_exists(
diff --git a/tests/util/test_template.py b/tests/util/test_template.py
index 844826f80d5..314f6b887b7 100644
--- a/tests/util/test_template.py
+++ b/tests/util/test_template.py
@@ -1,8 +1,8 @@
 """
-tests.test_util
-~~~~~~~~~~~~~~~~~
+tests.util.test_template
+~~~~~~~~~~~~~~~~~~~~~~~~
 
-Tests Home Assistant util methods.
+Tests Home Assistant template util methods.
 """
 # pylint: disable=too-many-public-methods
 import unittest
-- 
GitLab