code: def test_load_call_unload_extensions(
      graph_creation_extension2, extension1
  ):
      """
      Ensure extensions can be loaded, run, and unloaded.
      """
      from cugraph_service_server.cugraph_handler import CugraphHandler
      from cugraph_service_client.exceptions import CugraphServiceError
  
      handler = CugraphHandler()
  
      graph_creation_extension_dir = graph_creation_extension2
      extension_dir = extension1
  
      # Loading
      gc_ext_mod_names = handler.load_graph_creation_extensions(
          graph_creation_extension_dir
      )
      ext_mod_names = handler.load_extensions(extension_dir)
  
      # Running
      new_graph_ID = handler.call_graph_creation_extension(
          "my_graph_creation_function", "('a', 'b', 'c')", "{}"
      )
      assert new_graph_ID in handler.get_graph_ids()
  
      results = handler.call_extension(
          "my_nines_function", "(33, 'int32', 21, 'float64')", "{}"
      )
      # results is a ValueWrapper object which Thrift will understand to be a
      # Value, which it can serialize. Check the ValueWrapper object here.
      assert len(results.list_value) == 2
      assert len(results.list_value[0].list_value) == 33
      assert len(results.list_value[1].list_value) == 21
      assert (
          type(results.list_value[0].list_value[0].int32_value) is int
      )
      assert (
          type(results.list_value[1].list_value[0].double_value)
          is float
      )
      assert results.list_value[0].list_value[0].int32_value == 9
      assert results.list_value[1].list_value[0].double_value == 9.0
  
      # Unloading
      with pytest.raises(CugraphServiceError):
          handler.unload_extension_module("invalid_module")
  
      for mod_name in gc_ext_mod_names:
          handler.unload_extension_module(mod_name)
  
      with pytest.raises(CugraphServiceError):
          handler.call_graph_creation_extension(
              "my_graph_creation_function", "('a', 'b', 'c')", "{}"
          )
  
      handler.call_extension(
          "my_nines_function", "(33, 'int32', 21, 'float64')", "{}"
      )
  
      for mod_name in ext_mod_names:
          handler.unload_extension_module(mod_name)
  
      with pytest.raises(CugraphServiceError):
          handler.call_extension(
              "my_nines_function", "(33, 'int32', 21, 'float64')", "{}"
          )
  
file_path: cugraph/python/cugraph-service/tests/test_cugraph_handler.py
imports: import sys
  import pickle
  from pathlib import Path
  import pytest
label_desc: Use image node_id 2 for calling a global function with example usage: test_load_call_unload_extensions(graph_creation_extension2, extension1) without return types