code: def test_create_lineage_when_no_lineage_exists_with_raw_data_only():
      lineage_handler = FeatureProcessorLineageHandler(
          pipeline_name=PIPELINE_NAME,
          pipeline_arn=PIPELINE_ARN,
          pipeline=PIPELINE,
          inputs=RAW_DATA_INPUT,
          output=FEATURE_GROUP_DATA_SOURCE[0].name,
          transformation_code=TRANSFORMATION_CODE_INPUT_1,
          sagemaker_session=SAGEMAKER_SESSION_MOCK,
      )
      with patch.object(
          FeatureGroupLineageEntityHandler,
          "retrieve_feature_group_context_arns",
          side_effect=[
              FEATURE_GROUP_INPUT[0],
              FEATURE_GROUP_INPUT[1],
              FEATURE_GROUP_INPUT[0],
          ],
      ) as retrieve_feature_group_context_arns_method, patch.object(
          S3LineageEntityHandler,
          "retrieve_raw_data_artifact",
          side_effect=[
              RAW_DATA_INPUT_ARTIFACTS[0],
              RAW_DATA_INPUT_ARTIFACTS[1],
              RAW_DATA_INPUT_ARTIFACTS[2],
              RAW_DATA_INPUT_ARTIFACTS[3],
          ],
      ) as retrieve_raw_data_artifact_method, patch.object(
          S3LineageEntityHandler,
          "create_transformation_code_artifact",
          return_value=TRANSFORMATION_CODE_ARTIFACT_1,
      ) as create_transformation_code_artifact_method, patch.object(
          PipelineLineageEntityHandler,
          "load_pipeline_context",
          side_effect=RESOURCE_NOT_FOUND_EXCEPTION,
      ) as load_pipeline_context_method, patch.object(
          PipelineLineageEntityHandler,
          "create_pipeline_context",
          return_value=PIPELINE_CONTEXT,
      ), patch.object(
          PipelineVersionLineageEntityHandler,
          "create_pipeline_version_context",
          return_value=PIPELINE_VERSION_CONTEXT,
      ), patch.object(
          PipelineVersionLineageEntityHandler,
          "load_pipeline_version_context",
          return_value=PIPELINE_VERSION_CONTEXT,
      ) as load_pipeline_version_context_method, patch.object(
          LineageAssociationHandler,
          "list_upstream_associations",
          side_effect=[
              generate_pipeline_version_upstream_feature_group_list(),
              [],
              generate_pipeline_version_upstream_transformation_code(),
          ],
      ) as list_upstream_associations_method, patch.object(
          LineageAssociationHandler,
          "list_downstream_associations",
          return_value=generate_pipeline_version_downstream_feature_group(),
      ) as list_downstream_associations_method, patch.object(
          PipelineLineageEntityHandler,
          "update_pipeline_context",
      ) as update_pipeline_context_method, patch.object(
          LineageAssociationHandler,
          "add_upstream_feature_group_data_associations",
      ) as add_upstream_feature_group_data_associations_method, patch.object(
          LineageAssociationHandler,
          "add_downstream_feature_group_data_associations",
      ) as add_downstream_feature_group_data_associations_method, patch.object(
          LineageAssociationHandler,
          "add_upstream_raw_data_associations",
      ) as add_upstream_raw_data_associations_method, patch.object(
          LineageAssociationHandler,
          "add_upstream_transformation_code_associations",
      ) as add_upstream_transformation_code_associations_method, patch.object(
          LineageAssociationHandler,
          "add_pipeline_and_pipeline_version_association",
      ) as add_pipeline_and_pipeline_version_association_method, patch.object(
          Artifact,
          "set_tags",
          return_value={
              "Tags": [
                  dict(Key="key_1", Value="value_1"),
                  dict(Key="key_2", Value="value_2"),
              ]
          },
      ) as artifact_set_tags:
          lineage_handler.create_lineage(TAGS)
  
      retrieve_feature_group_context_arns_method.assert_called_once_with(
          feature_group_name=FEATURE_GROUP_DATA_SOURCE[0].name,
          sagemaker_session=SAGEMAKER_SESSION_MOCK,
      )
  
      retrieve_raw_data_artifact_method.assert_has_calls(
          [
              call(
                  raw_data=RAW_DATA_INPUT[0],
                  sagemaker_session=SAGEMAKER_SESSION_MOCK,
              ),
              call(
                  raw_data=RAW_DATA_INPUT[1],
                  sagemaker_session=SAGEMAKER_SESSION_MOCK,
              ),
              call(
                  raw_data=RAW_DATA_INPUT[2],
                  sagemaker_session=SAGEMAKER_SESSION_MOCK,
              ),
              call(
                  raw_data=RAW_DATA_INPUT[3],
                  sagemaker_session=SAGEMAKER_SESSION_MOCK,
              ),
          ]
      )
      assert 4 == retrieve_raw_data_artifact_method.call_count
  
      create_transformation_code_artifact_method.assert_called_once_with(
          transformation_code=TRANSFORMATION_CODE_INPUT_1,
          pipeline_last_update_time=PIPELINE[
              "LastModifiedTime"
          ].strftime("%s"),
          sagemaker_session=SAGEMAKER_SESSION_MOCK,
      )
  
      load_pipeline_context_method.assert_called_once_with(
          pipeline_name=PIPELINE_NAME,
          creation_time=PIPELINE["CreationTime"].strftime("%s"),
          sagemaker_session=SAGEMAKER_SESSION_MOCK,
      )
  
      load_pipeline_version_context_method.assert_not_called()
      list_upstream_associations_method.assert_not_called()
      list_downstream_associations_method.assert_not_called()
      update_pipeline_context_method.assert_not_called()
  
      add_upstream_feature_group_data_associations_method.assert_called_once_with(
          feature_group_inputs=[],
          pipeline_context_arn=PIPELINE_CONTEXT.context_arn,
          pipeline_version_context_arn=PIPELINE_VERSION_CONTEXT.context_arn,
          sagemaker_session=SAGEMAKER_SESSION_MOCK,
      )
  
      add_downstream_feature_group_data_associations_method.assert_called_once_with(
          feature_group_output=FEATURE_GROUP_INPUT[0],
          pipeline_context_arn=PIPELINE_CONTEXT.context_arn,
          pipeline_version_context_arn=PIPELINE_VERSION_CONTEXT.context_arn,
          sagemaker_session=SAGEMAKER_SESSION_MOCK,
      )
  
      add_upstream_raw_data_associations_method.assert_called_once_with(
          raw_data_inputs=RAW_DATA_INPUT_ARTIFACTS,
          pipeline_context_arn=PIPELINE_CONTEXT.context_arn,
          pipeline_version_context_arn=PIPELINE_VERSION_CONTEXT.context_arn,
          sagemaker_session=SAGEMAKER_SESSION_MOCK,
      )
  
      add_upstream_transformation_code_associations_method.assert_called_once_with(
          transformation_code_artifact=TRANSFORMATION_CODE_ARTIFACT_1,
          pipeline_version_context_arn=PIPELINE_VERSION_CONTEXT.context_arn,
          sagemaker_session=SAGEMAKER_SESSION_MOCK,
      )
  
      add_pipeline_and_pipeline_version_association_method.assert_called_once_with(
          pipeline_context_arn=PIPELINE_CONTEXT.context_arn,
          pipeline_version_context_arn=PIPELINE_VERSION_CONTEXT.context_arn,
          sagemaker_session=SAGEMAKER_SESSION_MOCK,
      )
  
      artifact_set_tags.assert_called_once_with(TAGS)
  
imports: from __future__ import absolute_import
  import copy
  import datetime
  from typing import Iterator, List
  import pytest
  from mock import call, patch, Mock
  from sagemaker import Session
  from sagemaker.feature_store.feature_processor._event_bridge_scheduler_helper import EventBridgeSchedulerHelper
  from sagemaker.feature_store.feature_processor._event_bridge_rule_helper import EventBridgeRuleHelper
  from sagemaker.feature_store.feature_processor.lineage.constants import TRANSFORMATION_CODE_STATUS_INACTIVE
  from sagemaker.lineage.context import Context
  from sagemaker.lineage.artifact import Artifact
  from test_constants import FEATURE_GROUP_DATA_SOURCE, FEATURE_GROUP_INPUT, LAST_UPDATE_TIME, PIPELINE, PIPELINE_ARN, PIPELINE_CONTEXT, PIPELINE_NAME, PIPELINE_VERSION_CONTEXT, RAW_DATA_INPUT, RAW_DATA_INPUT_ARTIFACTS, RESOURCE_NOT_FOUND_EXCEPTION, SAGEMAKER_SESSION_MOCK, SCHEDULE_ARTIFACT_RESULT, PIPELINE_TRIGGER_ARTIFACT, TRANSFORMATION_CODE_ARTIFACT_1, TRANSFORMATION_CODE_ARTIFACT_2, TRANSFORMATION_CODE_INPUT_1, TRANSFORMATION_CODE_INPUT_2, ARTIFACT_SUMMARY, ARTIFACT_RESULT
  from sagemaker.feature_store.feature_processor.lineage._feature_group_lineage_entity_handler import FeatureGroupLineageEntityHandler
  from sagemaker.feature_store.feature_processor.lineage._feature_processor_lineage import FeatureProcessorLineageHandler
  from sagemaker.feature_store.feature_processor.lineage._lineage_association_handler import LineageAssociationHandler
  from sagemaker.feature_store.feature_processor.lineage._pipeline_lineage_entity_handler import PipelineLineageEntityHandler
  from sagemaker.feature_store.feature_processor.lineage._pipeline_schedule import PipelineSchedule
  from sagemaker.feature_store.feature_processor.lineage._pipeline_trigger import PipelineTrigger
  from sagemaker.feature_store.feature_processor.lineage._pipeline_version_lineage_entity_handler import PipelineVersionLineageEntityHandler
  from sagemaker.feature_store.feature_processor.lineage._s3_lineage_entity_handler import S3LineageEntityHandler
  from sagemaker.lineage._api_types import AssociationSummary
label_desc: Use image node_id 4 for calling a global function with example usage: test_create_lineage_when_no_lineage_exists_with_raw_data_only() without return types