[core] Assert stateless capture in test, fix TemplatableFn comment

This commit is contained in:
J. Nick Koston
2026-04-07 14:10:18 -10:00
parent 8f6acbd42d
commit 0dddeea4d2
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -845,7 +845,7 @@ async def templatable(
if output_type is std_string:
return FlashStringLiteral(value)
# For non-string types, wrap constants in stateless lambdas so that
# TemplatableValue stores them as function pointers (4 bytes vs 8).
# TemplatableFn (used by TEMPLATABLE_VALUE macro) stores them as function pointers.
if output_type is not None:
from esphome.cpp_types import std_string
+1
View File
@@ -673,6 +673,7 @@ async def test_templatable__string_with_non_string_output_type() -> None:
result = await cg.templatable("hello", [], ct.bool_)
assert isinstance(result, cg.LambdaExpression)
assert result.capture == ""
@pytest.mark.asyncio