code: def test_candidate_estimator_fit_initialization_with_sagemaker_config_injection(
      sagemaker_session,
  ):
      sagemaker_session.sagemaker_config = SAGEMAKER_CONFIG_TRAINING_JOB
      sagemaker_session.train = Mock()
      sagemaker_session.transform = Mock()
  
      desc_training_job_response = copy.deepcopy(TRAINING_JOB)
      del desc_training_job_response["VpcConfig"]
      del desc_training_job_response["OutputDataConfig"]["KmsKeyId"]
  
      sagemaker_session.sagemaker_client.describe_training_job = Mock(
          name="describe_training_job",
          return_value=desc_training_job_response,
      )
      candidate_estimator = CandidateEstimator(
          CANDIDATE_DICT, sagemaker_session=sagemaker_session
      )
      candidate_estimator._check_all_job_finished = Mock(
          name="_check_all_job_finished", return_value=True
      )
      inputs = DEFAULT_S3_INPUT_DATA
      candidate_estimator.fit(inputs)
      expected_volume_kms_key_id = SAGEMAKER_CONFIG_TRAINING_JOB[
          "SageMaker"
      ]["TrainingJob"]["ResourceConfig"]["VolumeKmsKeyId"]
      expected_vpc_config = SAGEMAKER_CONFIG_TRAINING_JOB["SageMaker"][
          "TrainingJob"
      ]["VpcConfig"]
      expected_enable_inter_container_traffic_encryption = (
          SAGEMAKER_CONFIG_TRAINING_JOB["SageMaker"]["TrainingJob"][
              "EnableInterContainerTrafficEncryption"
          ]
      )
  
      for train_call in sagemaker_session.train.call_args_list:
          train_args = train_call.kwargs
          assert train_args["vpc_config"] == expected_vpc_config
          assert (
              train_args["resource_config"]["VolumeKmsKeyId"]
              == expected_volume_kms_key_id
          )
          assert (
              train_args["encrypt_inter_container_traffic"]
              == expected_enable_inter_container_traffic_encryption
          )
  
imports: from __future__ import absolute_import
  import copy
  import pytest
  from mock import Mock, patch
  from sagemaker import AutoML, AutoMLJob, AutoMLInput, CandidateEstimator, PipelineModel
  from sagemaker.predictor import Predictor
  from sagemaker.session_settings import SessionSettings
  from sagemaker.workflow.functions import Join
  from tests.unit import SAGEMAKER_CONFIG_AUTO_ML, SAGEMAKER_CONFIG_TRAINING_JOB, _test_default_bucket_and_prefix_combinations, DEFAULT_S3_BUCKET_NAME, DEFAULT_S3_OBJECT_KEY_PREFIX_NAME
label_desc: Use image node_id 26 for calling a global function with example usage: test_candidate_estimator_fit_initialization_with_sagemaker_config_injection(sagemaker_session) without return types