From 84a8ac3772bbc1af78021e42aaa17100e55b4f5e Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 22 Aug 2026 14:54:24 -0500 Subject: [PATCH 1/2] Use a docstring instead of pass in the to_code test stub --- tests/unit_tests/test_main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit_tests/test_main.py b/tests/unit_tests/test_main.py index a47edb2ece..a65492a602 100644 --- a/tests/unit_tests/test_main.py +++ b/tests/unit_tests/test_main.py @@ -7202,7 +7202,7 @@ async def test_wrap_to_code_comment_is_insertion_order_independent() -> None: comments: list[str] = [] async def to_code(conf): - pass + """Accept any config; only the wrapper's comment output matters.""" comp = SimpleNamespace(to_code=to_code, config_schema=object()) wrapped = _wrap_to_code("demo", comp, yaml_util) From fd7e340e810859c072aeb5ed136cb698bc1edb02 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 22 Aug 2026 14:54:39 -0500 Subject: [PATCH 2/2] Type-hint the to_code test stub --- tests/unit_tests/test_main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/unit_tests/test_main.py b/tests/unit_tests/test_main.py index a65492a602..97bdc09f4a 100644 --- a/tests/unit_tests/test_main.py +++ b/tests/unit_tests/test_main.py @@ -123,6 +123,7 @@ from esphome.espota2 import ( OTA_TYPE_UPDATE_PARTITION_TABLE, ) from esphome.platformio import toolchain +from esphome.types import ConfigType from esphome.util import BootselResult, FlashImage from esphome.zeroconf import _await_discovery, discover_mdns_devices @@ -7201,7 +7202,7 @@ async def test_wrap_to_code_comment_is_insertion_order_independent() -> None: main.cpp and relink the firmware on every run.""" comments: list[str] = [] - async def to_code(conf): + async def to_code(conf: ConfigType) -> None: """Accept any config; only the wrapper's comment output matters.""" comp = SimpleNamespace(to_code=to_code, config_schema=object())