code: def test_list_sort(trial_components, sagemaker_session):
      slack = datetime.timedelta(minutes=1)
      now = datetime.datetime.now(datetime.timezone.utc)
      trial_component_names = [
          tc.trial_component_name for tc in trial_components
      ]
  
      for sort_order in ["Ascending", "Descending"]:
          trial_component_names_listed = [
              s.trial_component_name
              for s in trial_component._TrialComponent.list(
                  created_after=now - slack,
                  created_before=now + slack,
                  sort_by="CreationTime",
                  sort_order=sort_order,
                  sagemaker_session=sagemaker_session,
              )
              if s.trial_component_name in trial_component_names
          ]
  
      if sort_order == "Descending":
          trial_component_names_listed = trial_component_names_listed[
              ::-1
          ]
      assert trial_component_names == trial_component_names_listed
      assert trial_component_names
  
file_path: sagemaker-python-sdk/tests/integ/sagemaker/experiments/test_trial_component.py
imports: from __future__ import absolute_import
  import datetime
  import uuid
  from sagemaker.experiments._api_types import _TrialComponentStatusType
  from tests.integ.sagemaker.experiments.helpers import EXP_INTEG_TEST_NAME_PREFIX
  from sagemaker.experiments import _api_types, trial_component
  from sagemaker.utilities.search_expression import Filter, Operator, SearchExpression
label_desc: Use image node_id 6 for calling a global function with example usage: test_list_sort(trial_components, sagemaker_session) without return types