code: def test_action_object_hooks() -> None:
      raw_data = np.array([1, 2, 3])
      action_object = ActionObject.from_obj(raw_data)
  
      def pre_add(context: Any, *args: Any, **kwargs: Any) -> Any:
          # double it
          new_value = args[0]
          new_value.syft_action_data_cache = (
              new_value.syft_action_data_cache * 2
          )
          return Ok((context, (new_value,), kwargs))
  
      def post_add(context: Any, name: str, new_result: Any) -> Any:
          # change return type to sum
          return Ok(sum(new_result))
  
      action_object._syft_pre_hooks__["__add__"] = [pre_add]
      action_object._syft_post_hooks__["__add__"] = [post_add]
  
      result = action_object + action_object
      x = result.syft_action_data
      y = sum((raw_data * 2) + raw_data)
      assert y == 18
      assert x == y
  
      action_object._syft_pre_hooks__["__add__"] = []
      action_object._syft_post_hooks__["__add__"] = []
  
imports: from typing import Any
  from typing import Dict
  from nacl.exceptions import BadSignatureError
  import numpy
  import pytest
  from result import Ok
  import syft
  from syft.client.api import SignedSyftAPICall
  from syft.client.api import SyftAPICall
  from syft.node.credentials import SIGNING_KEY_FOR
  from syft.node.credentials import SyftSigningKey
  from syft.node.credentials import SyftVerifyKey
  from syft.node.worker import Worker
  from syft.service.action.action_object import ActionObject
  from syft.service.action.action_store import DictActionStore
  from syft.service.context import AuthedServiceContext
  from syft.service.queue.queue_stash import QueueItem
  from syft.service.response import SyftAttributeError
  from syft.service.response import SyftError
  from syft.service.user.user import User
  from syft.service.user.user import UserCreate
  from syft.service.user.user import UserView
  from syft.service.user.user_service import UserService
  from syft.types.uid import UID
label_desc: Use image node_id 8 for calling a global function with example usage: test_action_object_hooks() and returns: Ok, Ok