Make tests pass flake8

This commit is contained in:
Paulus Schoutsen committed 2016-02-14 13:07:21 -08:00
1 parent dd2aec0a08
commit bade0e0d71
10 files changed
+51 -25

No files matched your search

@@ -365,7 +365,7 @@ class TestAutomationNumericState(unittest.TestCase):
self.hass.pool.block_till_done()
self.assertEqual(0, len(self.calls))
def test_if_fires_on_attribute_change_with_attribute_below_multiple_attributes(self):
def test_fires_on_attr_change_with_attribute_below_and_multiple_attr(self):
self.assertTrue(automation.setup(self.hass, {
automation.DOMAIN: {
'trigger': {
@@ -380,7 +380,8 @@ 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))
@@ -390,7 +391,8 @@ class TestAutomationNumericState(unittest.TestCase):
'trigger': {
'platform': 'numeric_state',
'entity_id': 'test.entity',
'value_template': '{{ state.attributes.test_attribute[2] }}',
'value_template':
'{{ state.attributes.test_attribute[2] }}',
'below': 10,
},
'action': {
@@ -399,7 +401,8 @@ 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))
@@ -409,7 +412,8 @@ class TestAutomationNumericState(unittest.TestCase):
'trigger': {
'platform': 'numeric_state',
'entity_id': 'test.entity',
'value_template': '{{ state.attributes.test_attribute | multiply(10) }}',
'value_template':
'{{ state.attributes.test_attribute | multiply(10) }}',
'below': 10,
},
'action': {
@@ -418,11 +422,12 @@ 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))
def test_if_not_fires_on_attribute_change_with_attribute_not_below_multiple_attributes(self):
def test_not_fires_on_attr_change_with_attr_not_below_multiple_attr(self):
self.assertTrue(automation.setup(self.hass, {
automation.DOMAIN: {
'trigger': {
@@ -437,7 +442,8 @@ 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))
+2 -1
View File
@@ -256,7 +256,8 @@ class TestAutomationTemplate(unittest.TestCase):
automation.DOMAIN: {
'trigger': {
'platform': 'template',
'value_template': '{{ not is_state("test.entity", "world") }}',
'value_template':
'{{ not is_state("test.entity", "world") }}',
},
'action': {
'service': 'test.automation'
+2 -1
View File
@@ -114,7 +114,8 @@ class TestDemoMediaPlayer(unittest.TestCase):
assert 0 < (mp.SUPPORT_PREVIOUS_TRACK &
state.attributes.get('supported_media_commands'))
@patch('homeassistant.components.media_player.demo.DemoYoutubePlayer.media_seek')
@patch('homeassistant.components.media_player.demo.DemoYoutubePlayer.'
'media_seek')
def test_play_media(self, mock_seek):
assert mp.setup(self.hass, {'media_player': {'platform': 'demo'}})
ent_id = 'media_player.living_room'
+1 -1
View File
@@ -64,7 +64,7 @@ class TestTemplateSensor:
'sensors': {
'test_template_sensor': {
'value_template':
"It {{ states.sensor.test_state.attributes.missing }}."
"It {{ states.sensor.test_state.attributes.missing }}."
}
}
}
+3 -2
View File
@@ -162,7 +162,8 @@ class TestProximity:
self.hass.pool.block_till_done()
state = self.hass.states.get('proximity.home')
assert state.state == '0'
assert (state.attributes.get('nearest') == 'test1, test2') or (state.attributes.get('nearest') == 'test2, test1')
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):
@@ -447,7 +448,7 @@ class TestProximity:
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):
def test_device_tracker_test1_awayfurther_test2_first(self):
self.hass.states.set(
'device_tracker.test1', 'not_home',
{
@@ -131,7 +131,6 @@ class TestHoneywell(unittest.TestCase):
devices = [x[0][1].deviceid for x in result]
self.assertEqual([mock.sentinel.loc2dev1], devices)
@mock.patch('evohomeclient.EvohomeClient')
@mock.patch('homeassistant.components.thermostat.honeywell.'
'RoundThermostat')