Make tests pass flake8
This commit is contained in:
parent
dd2aec0a08
commit
bade0e0d71
10 changed files with 51 additions and 25 deletions
|
@ -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))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue