mirror of
https://github.com/esphome/esphome.git
synced 2026-09-15 17:18:40 +00:00
[core] Assert stateless capture in test, fix TemplatableFn comment
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user