Drop template wrapper, call register_component_ directly

The template wrapper caused the compiler to make different
optimization decisions on setup(), negating the savings.
Calling register_component_ directly was -4 bytes.

Co-Authored-By: J. Nick Koston <nick@koston.org>
This commit is contained in:
J. Nick Koston
2026-02-27 21:40:03 -10:00
co-authored by J. Nick Koston
parent d2af639e71
commit 9967fc54d5
6 changed files with 9 additions and 16 deletions
+4 -4
View File
@@ -16,7 +16,7 @@ async def test_gpio_pin_expression__conf_is_none(monkeypatch):
async def test_register_component(monkeypatch):
var = Mock(base="foo.bar")
app_mock = Mock(register_component=Mock(return_value=var))
app_mock = Mock(register_component_=Mock(return_value=var))
monkeypatch.setattr(ch, "App", app_mock)
core_mock = Mock(component_ids=["foo.bar"])
@@ -29,7 +29,7 @@ async def test_register_component(monkeypatch):
assert actual is var
assert add_mock.call_count == 2
app_mock.register_component.assert_called_with(var)
app_mock.register_component_.assert_called_with(var)
assert core_mock.component_ids == []
@@ -48,7 +48,7 @@ async def test_register_component__no_component_id(monkeypatch):
async def test_register_component__with_setup_priority(monkeypatch):
var = Mock(base="foo.bar")
app_mock = Mock(register_component=Mock(return_value=var))
app_mock = Mock(register_component_=Mock(return_value=var))
monkeypatch.setattr(ch, "App", app_mock)
core_mock = Mock(component_ids=["foo.bar"])
@@ -68,5 +68,5 @@ async def test_register_component__with_setup_priority(monkeypatch):
assert actual is var
add_mock.assert_called()
assert add_mock.call_count == 4
app_mock.register_component.assert_called_with(var)
app_mock.register_component_.assert_called_with(var)
assert core_mock.component_ids == []