mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 13:27:14 +00:00
[core] Pack entity flags into configure_entity_() and protect setters (#14564)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
"""Tests for the button component"""
|
||||
|
||||
from tests.component_tests.helpers import INTERNAL_BIT, extract_packed_value
|
||||
|
||||
|
||||
def test_button_is_setup(generate_main):
|
||||
"""
|
||||
@@ -39,6 +41,6 @@ def test_button_config_value_internal_set(generate_main):
|
||||
# When
|
||||
main_cpp = generate_main("tests/component_tests/button/test_button.yaml")
|
||||
|
||||
# Then
|
||||
assert "wol_1->set_internal(true);" in main_cpp
|
||||
assert "wol_2->set_internal(false);" in main_cpp
|
||||
# Then: wol_1 has internal: true, wol_2 has internal: false
|
||||
assert extract_packed_value(main_cpp, "wol_1") & INTERNAL_BIT != 0
|
||||
assert extract_packed_value(main_cpp, "wol_2") & INTERNAL_BIT == 0
|
||||
|
||||
Reference in New Issue
Block a user