async def test_proactive_adaptation_toggle(hass):
    """Validate that a proactive adaptation updates service calls which toggle a light on,
    but not those which toggle off.

    This test is based on the fact that contexts of proactive adaptations are recorded.
    """
    switch, _ = await setup_lights_and_switch(hass, {CONF_INTERCEPT: True}, True)

    # Toggle ON
    await hass.services.async_call(
        LIGHT_DOMAIN,
        SERVICE_TOGGLE,
        {ATTR_ENTITY_ID: ENTITY_LIGHT_3},
        blocking=True,
        context=Context(id="test1"),
    )

    assert switch.manager.is_proactively_adapting("test1")

    # Toggle OFF
    await hass.services.async_call(
        LIGHT_DOMAIN,
        SERVICE_TOGGLE,
        {ATTR_ENTITY_ID: ENTITY_LIGHT_3},
        blocking=True,
        context=Context(id="test2"),
    )

    assert not switch.manager.is_proactively_adapting("test2")
Validate that a proactive adaptation updates service calls which toggle a light on,
    but not those which toggle off.

    This test is based on the fact that contexts of proactive adaptations are recorded.
    
tests/test_switch.py