mirror of
https://github.com/esphome/esphome.git
synced 2026-09-25 14:00:25 +00:00
Simplify to uint8_t index, add friend declarations, fix tests
- Drop 9-bit index scheme in favor of plain uint8_t (max 255 unique source names, overflow warns in Python and returns 0) - Add friend declarations for setup()/original_setup() so generated code can call protected set_component_source_() - Move get_component_log_str() out of line - Fix test mocks to provide CORE.data dict
This commit is contained in:
@@ -23,7 +23,7 @@ async def test_register_component(monkeypatch):
|
||||
app_mock = Mock(register_component_=Mock(return_value=var))
|
||||
monkeypatch.setattr(ch, "App", app_mock)
|
||||
|
||||
core_mock = Mock(component_ids=["foo.bar"])
|
||||
core_mock = Mock(component_ids=["foo.bar"], data={})
|
||||
monkeypatch.setattr(ch, "CORE", core_mock)
|
||||
|
||||
add_mock = Mock()
|
||||
@@ -59,7 +59,7 @@ async def test_register_component__with_setup_priority(monkeypatch):
|
||||
app_mock = Mock(register_component_=Mock(return_value=var))
|
||||
monkeypatch.setattr(ch, "App", app_mock)
|
||||
|
||||
core_mock = Mock(component_ids=["foo.bar"])
|
||||
core_mock = Mock(component_ids=["foo.bar"], data={})
|
||||
monkeypatch.setattr(ch, "CORE", core_mock)
|
||||
|
||||
add_mock = Mock()
|
||||
|
||||
Reference in New Issue
Block a user