async def test_service_call_interceptor_data_manipulation(hass):
    """Test service call data manipulation by service call interceptor."""
    service_func_mock = AsyncMock()
    hass.services.async_register(LIGHT_DOMAIN, SERVICE_TURN_ON, service_func_mock)

    async def intercept_func(call: ServiceCall, data: ServiceData):
        data["test1"] = "changed"
        data["test2"] = "added"

    setup_service_call_interceptor(
        hass,
        LIGHT_DOMAIN,
        SERVICE_TURN_ON,
        intercept_func,
    )

    await hass.services.async_call(
        LIGHT_DOMAIN,
        SERVICE_TURN_ON,
        {"test1": "initial"},
        blocking=True,
    )

    (service_call,) = service_func_mock.call_args[0]
    assert service_call.data == {"test1": "changed", "test2": "added"}
    assert isinstance(service_call.data, ReadOnlyDict)
Test service call data manipulation by service call interceptor.
tests/test_hass_utils.py