code: def test_list(association_objs, sagemaker_session):
      slack = datetime.timedelta(minutes=1)
      now = datetime.datetime.now(datetime.timezone.utc)
      association_keys = [
          assoc_obj.source_arn + ":" + assoc_obj.destination_arn
          for assoc_obj in association_objs
      ]
  
      for sort_order in ["Ascending", "Descending"]:
          association_keys_listed = []
          source_arn = [
              assoc_obj.source_arn for assoc_obj in association_objs
          ][0]
          listed = association.Association.list(
              source_arn=source_arn,
              created_after=now - slack,
              created_before=now + slack,
              sort_by="CreationTime",
              sort_order=sort_order,
              sagemaker_session=sagemaker_session,
          )
  
          for assoc in listed:
              key = assoc.source_arn + ":" + assoc.destination_arn
              if key in association_keys:
                  association_keys_listed.append(key)
  
      if sort_order == "Descending":
          association_names_listed = association_keys_listed[::-1]
      assert association_keys[::-1] == association_names_listed
      # sanity check
      assert association_keys_listed
  
      for listed_asscn in listed:
          assert listed_asscn.created_by is None
  
file_path: sagemaker-python-sdk/tests/integ/sagemaker/lineage/test_association.py
imports: from __future__ import absolute_import
  import datetime
  import time
  import pytest
  from sagemaker.lineage import association
label_desc: Use image node_id 2 for calling a global function with example usage: test_list(association_objs, sagemaker_session) without return types