code: def test_datasets(
      static_approval_action, static_dataset_artifact, sagemaker_session
  ):
      try:
          sagemaker_session.sagemaker_client.add_association(
              SourceArn=static_dataset_artifact.artifact_arn,
              DestinationArn=static_approval_action.action_arn,
              AssociationType="ContributedTo",
          )
      except Exception:
          print("Source and Destination association already exists.")
  
      time.sleep(3)
      artifacts_from_query = static_approval_action.datasets()
  
      assert len(artifacts_from_query) > 0
      for artifact in artifacts_from_query:
          assert "artifact" in artifact.artifact_arn
          assert artifact.artifact_type == "DataSet"
  
      try:
          sagemaker_session.sagemaker_client.delete_association(
              SourceArn=static_dataset_artifact.artifact_arn,
              DestinationArn=static_approval_action.action_arn,
          )
      except Exception:
          pass
  
file_path: sagemaker-python-sdk/tests/integ/sagemaker/lineage/test_action.py
imports: from __future__ import absolute_import
  import datetime
  import logging
  import time
  import pytest
  from sagemaker.lineage import action
  from sagemaker.lineage.query import LineageQueryDirectionEnum
label_desc: Use image node_id 10 for calling a global function with example usage: test_datasets(static_approval_action, static_dataset_artifact, sagemaker_session) without return types