From 187185698e94519808950959d7daf4a80a0f318d Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Sun, 6 Sep 2026 11:42:55 +0200 Subject: [PATCH] Add test_expand_light_groups (#319) * Add test_expand_light_groups * Add imports * import --------- Co-authored-by: Benjamin Auquite --- tests/test_switch.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_switch.py b/tests/test_switch.py index 0d16f64f..37395f70 100644 --- a/tests/test_switch.py +++ b/tests/test_switch.py @@ -71,6 +71,7 @@ from homeassistant.components.adaptive_lighting.switch import ( AdaptiveSwitch, SimpleSwitch, _attributes_have_changed, + _expand_light_groups, color_difference_redmean, create_context, is_our_context, @@ -2551,6 +2552,19 @@ def test_lerp_color_hsv(): lerp_color_hsv((255, 0, 0), (0, 255, 0), 1.1) +async def test_expand_light_groups_waits_for_group_state(hass): + """Test expansion waits until a light group's state is available.""" + await setup_switch(hass, {}) + group = "light.pending_group" + members = ["light.light_1", "light.light_2"] + + assert _expand_light_groups(hass, [group]) == [group] + + hass.states.async_set(group, STATE_ON, {ATTR_ENTITY_ID: members}) + + assert _expand_light_groups(hass, [group]) == members + + @pytest.mark.parametrize("proactive_service_call_adaptation", [True, False]) @pytest.mark.parametrize("take_over_control", [True, False]) @pytest.mark.parametrize("multi_light_intercept", [True, False])