Add typing to homeassistant/*.py and homeassistant/util/ (#15569)
* Add typing to homeassistant/*.py and homeassistant/util/ * Fix wrong merge * Restore iterable in OrderedSet * Fix tests
This commit is contained in:
1 parent
b7c336a687
commit
140a874917
27 files changed
+532
-384
No files matched your search
@@ -437,10 +437,12 @@ class TestAutomation(unittest.TestCase):
|
||||
}
|
||||
}
|
||||
}}):
|
||||
automation.reload(self.hass)
|
||||
self.hass.block_till_done()
|
||||
# De-flake ?!
|
||||
self.hass.block_till_done()
|
||||
with patch('homeassistant.config.find_config_file',
|
||||
return_value=''):
|
||||
automation.reload(self.hass)
|
||||
self.hass.block_till_done()
|
||||
# De-flake ?!
|
||||
self.hass.block_till_done()
|
||||
|
||||
assert self.hass.states.get('automation.hello') is None
|
||||
assert self.hass.states.get('automation.bye') is not None
|
||||
@@ -485,8 +487,10 @@ class TestAutomation(unittest.TestCase):
|
||||
|
||||
with patch('homeassistant.config.load_yaml_config_file', autospec=True,
|
||||
return_value={automation.DOMAIN: 'not valid'}):
|
||||
automation.reload(self.hass)
|
||||
self.hass.block_till_done()
|
||||
with patch('homeassistant.config.find_config_file',
|
||||
return_value=''):
|
||||
automation.reload(self.hass)
|
||||
self.hass.block_till_done()
|
||||
|
||||
assert self.hass.states.get('automation.hello') is None
|
||||
|
||||
@@ -521,8 +525,10 @@ class TestAutomation(unittest.TestCase):
|
||||
|
||||
with patch('homeassistant.config.load_yaml_config_file',
|
||||
side_effect=HomeAssistantError('bla')):
|
||||
automation.reload(self.hass)
|
||||
self.hass.block_till_done()
|
||||
with patch('homeassistant.config.find_config_file',
|
||||
return_value=''):
|
||||
automation.reload(self.hass)
|
||||
self.hass.block_till_done()
|
||||
|
||||
assert self.hass.states.get('automation.hello') is not None
|
||||
|
||||
|
||||
@@ -365,8 +365,10 @@ class TestComponentsGroup(unittest.TestCase):
|
||||
'icon': 'mdi:work',
|
||||
'view': True,
|
||||
}}}):
|
||||
group.reload(self.hass)
|
||||
self.hass.block_till_done()
|
||||
with patch('homeassistant.config.find_config_file',
|
||||
return_value=''):
|
||||
group.reload(self.hass)
|
||||
self.hass.block_till_done()
|
||||
|
||||
assert sorted(self.hass.states.entity_ids()) == \
|
||||
['group.all_tests', 'group.hello']
|
||||
|
||||
@@ -199,8 +199,10 @@ class TestScriptComponent(unittest.TestCase):
|
||||
}
|
||||
}]
|
||||
}}}):
|
||||
script.reload(self.hass)
|
||||
self.hass.block_till_done()
|
||||
with patch('homeassistant.config.find_config_file',
|
||||
return_value=''):
|
||||
script.reload(self.hass)
|
||||
self.hass.block_till_done()
|
||||
|
||||
assert self.hass.states.get(ENTITY_ID) is None
|
||||
assert not self.hass.services.has_service(script.DOMAIN, 'test')
|
||||
|
||||
Reference in new issue
Block a user