code: def test_from_raw_with_hf_api():
      """Test that the HfApi is correctly passed to the InferenceEndpoint."""
      endpoint = InferenceEndpoint.from_raw(
          MOCK_INITIALIZING,
          namespace="foo",
          api=HfApi(library_name="my-library", token="hf_***"),
      )
      assert endpoint._api.library_name == "my-library"
      assert endpoint._api.token == "hf_***"
  
file_path: hub-client/tests/test_inference_endpoints.py
imports: from datetime import datetime, timezone
  from unittest.mock import Mock, patch
  import pytest
  from huggingface_hub import AsyncInferenceClient, HfApi, InferenceClient, InferenceEndpoint, InferenceEndpointError, InferenceEndpointTimeoutError
label_desc: Use image node_id 2 for calling a global function with example usage: test_from_raw_with_hf_api() without return types