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:
J. Nick Koston
2026-03-22 21:16:18 -10:00
parent a6b9dd321d
commit 33bb87b813
4 changed files with 26 additions and 34 deletions
+2 -2
View File
@@ -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()