code: def test_add_trial_component(sagemaker_session):
      client = sagemaker_session.sagemaker_client
      trial = _Trial(sagemaker_session=sagemaker_session)
      trial.trial_name = "bar"
      trial.add_trial_component("foo")
      client.associate_trial_component.assert_called_with(
          TrialName="bar", TrialComponentName="foo"
      )
  
      tc = _TrialComponent(
          trial_component_name="tc-foo",
          sagemaker_session=sagemaker_session,
      )
      trial.add_trial_component(tc)
      client.associate_trial_component.assert_called_with(
          TrialName="bar", TrialComponentName=tc.trial_component_name
      )
  
imports: from __future__ import absolute_import
  import botocore
  import pytest
  import datetime
  from unittest.mock import patch
  from sagemaker import Session
  from sagemaker.experiments._api_types import TrialSummary
  from sagemaker.experiments.trial import _Trial
  from sagemaker.experiments.trial_component import _TrialComponent
label_desc: Use image node_id 7 for calling a global function with example usage: test_add_trial_component(sagemaker_session) without return types