code: def test_load_and_call_graph_creation_extension(
      graph_creation_extension2,
  ):
      """
      Ensures load_extensions reads the extensions and makes the new APIs they
      add available.
      """
      from cugraph_service_server.cugraph_handler import CugraphHandler
      from cugraph_service_client.exceptions import CugraphServiceError
  
      handler = CugraphHandler()
  
      extension_dir = graph_creation_extension2
  
      # DNE
      with pytest.raises(CugraphServiceError):
          handler.load_graph_creation_extensions(
              "/path/that/does/not/exist"
          )
  
      # Exists, but is a file
      with pytest.raises(CugraphServiceError):
          handler.load_graph_creation_extensions(__file__)
  
      # Load the extension and call the function defined in it
      ext_mod_names = handler.load_graph_creation_extensions(
          extension_dir
      )
      assert len(ext_mod_names) == 1
      expected_mod_name = (
          Path(extension_dir) / "my_extension.py"
      ).as_posix()
      assert ext_mod_names[0] == expected_mod_name
  
      # Private function should not be callable
      with pytest.raises(CugraphServiceError):
          handler.call_graph_creation_extension(
              "__my_private_function", "()", "{}"
          )
  
      # Function which DNE in the extension
      with pytest.raises(CugraphServiceError):
          handler.call_graph_creation_extension(
              "bad_function_name", "()", "{}"
          )
  
      # Wrong number of args
      with pytest.raises(CugraphServiceError):
          handler.call_graph_creation_extension(
              "my_graph_creation_function", "('a',)", "{}"
          )
  
      # This call should succeed and should result in a new PropertyGraph present
      # in the handler instance.
      new_graph_ID = handler.call_graph_creation_extension(
          "my_graph_creation_function", "('a', 'b', 'c')", "{}"
      )
  
      assert new_graph_ID in handler.get_graph_ids()
  
      # Inspect the PG and ensure it was created from my_graph_creation_function
      pG = handler._get_graph(new_graph_ID)
      edge_props = pG.edge_property_names
      assert "c" in edge_props
  
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 1 for calling a global function with example usage: test_load_and_call_graph_creation_extension(graph_creation_extension2) without return types