code: def test_add_upstream_feature_group_data_associations_when_association_already_exists():
      with patch.object(
          Association, "create", side_effect=VALIDATION_EXCEPTION
      ) as create_association_method:
          LineageAssociationHandler.add_upstream_feature_group_data_associations(
              feature_group_inputs=FEATURE_GROUP_INPUT,
              pipeline_context_arn="pipeline-context-arn",
              pipeline_version_context_arn="pipeline-version-context-arn",
              sagemaker_session=SAGEMAKER_SESSION_MOCK,
          )
  
      for feature_group in FEATURE_GROUP_INPUT:
          create_association_method.assert_has_calls(
              [
                  call(
                      source_arn=feature_group.pipeline_context_arn,
                      destination_arn="pipeline-context-arn",
                      association_type="ContributedTo",
                      sagemaker_session=SAGEMAKER_SESSION_MOCK,
                  ),
                  call(
                      source_arn=feature_group.pipeline_version_context_arn,
                      destination_arn="pipeline-version-context-arn",
                      association_type="ContributedTo",
                      sagemaker_session=SAGEMAKER_SESSION_MOCK,
                  ),
              ]
          )
          assert (
              len(FEATURE_GROUP_INPUT) * 2
              == create_association_method.call_count
          )
  
file_path: sagemaker-python-sdk/tests/unit/sagemaker/feature_store/feature_processor/lineage/test_lineage_association_handler.py
imports: from __future__ import absolute_import
  from mock import patch, call
  import pytest
  from sagemaker.feature_store.feature_processor.lineage._lineage_association_handler import LineageAssociationHandler
  from sagemaker.lineage.association import Association
  from botocore.exceptions import ClientError
  from test_constants import FEATURE_GROUP_INPUT, RAW_DATA_INPUT_ARTIFACTS, VALIDATION_EXCEPTION, NON_VALIDATION_EXCEPTION, SAGEMAKER_SESSION_MOCK, TRANSFORMATION_CODE_ARTIFACT_1
label_desc: Use image node_id 2 for calling a global function with example usage: test_add_upstream_feature_group_data_associations_when_association_already_exists() without return types