code: def test_api_cache_invalidation(worker):
      root_domain_client = worker.root_client
      dataset = sy.Dataset(
          name="test",
          asset_list=[
              sy.Asset(
                  name="test",
                  data=np.array([1, 2, 3]),
                  mock=np.array([1, 1, 1]),
                  mock_is_real=False,
              )
          ],
      )
      root_domain_client.upload_dataset(dataset)
      asset = root_domain_client.datasets[0].assets[0]
  
      @sy.syft_function(
          input_policy=sy.ExactMatch(x=asset),
          output_policy=sy.SingleExecutionExactOutput(),
      )
      def my_func(x):
          return x + 1
  
      my_func.code = dedent(my_func.code)
  
      assert root_domain_client.code.request_code_execution(my_func)
      # check that function is added to api without refreshing the api manually
      assert isinstance(root_domain_client.code.my_func, Callable)
  
file_path: PySyft/packages/syft/tests/syft/api_test.py
imports: from textwrap import dedent
  from typing import Callable
  import numpy
  import pytest
  import syft
  from syft.service.response import SyftAttributeError
  from syft.service.user.user import UserUpdate
  from syft.service.user.user_roles import ServiceRole
label_desc: Use image node_id 1 for calling a global function with example usage: test_api_cache_invalidation(worker) and returns: unknown