code: def test_pipeline_upsert_create_unexpected_failure(
      sagemaker_session_mock, role_arn
  ):
      # case 2: unexpected failure on create
      def _raise_unexpected_client_error(**kwargs):
          response = {
              "Error": {
                  "Code": "ValidationException",
                  "Message": "Name does not satisfy expression.",
              }
          }
          raise ClientError(
              error_response=response, operation_name="foo"
          )
  
      sagemaker_session_mock.sagemaker_client.create_pipeline = Mock(
          name="create_pipeline",
          side_effect=_raise_unexpected_client_error,
      )
  
      sagemaker_session_mock.sagemaker_client.update_pipeline.return_value = {
          "PipelineArn": "pipeline-arn"
      }
      sagemaker_session_mock.sagemaker_client.list_tags.return_value = {
          "Tags": [{"Key": "dummy", "Value": "dummy_tag"}]
      }
  
      tags = [
          {"Key": "foo", "Value": "abc"},
          {"Key": "bar", "Value": "xyz"},
      ]
  
      pipeline = Pipeline(
          name="MyPipeline",
          parameters=[],
          steps=[],
          sagemaker_session=sagemaker_session_mock,
      )
  
      with pytest.raises(ClientError):
          pipeline.upsert(role_arn=role_arn, tags=tags)
  
      sagemaker_session_mock.sagemaker_client.create_pipeline.assert_called_once_with(
          PipelineName="MyPipeline",
          RoleArn=role_arn,
          PipelineDefinition=pipeline.definition(),
          Tags=tags,
      )
      sagemaker_session_mock.sagemaker_client.update_pipeline.assert_not_called()
      sagemaker_session_mock.sagemaker_client.list_tags.assert_not_called()
      sagemaker_session_mock.sagemaker_client.add_tags.assert_not_called()
  
imports: from __future__ import absolute_import
  import copy
  import json
  import pytest
  from mock import Mock, call, patch
  from sagemaker import s3
  from sagemaker.remote_function.job import _JobSettings
  from sagemaker.session_settings import SessionSettings
  from sagemaker.workflow.condition_step import ConditionStep
  from sagemaker.workflow.conditions import ConditionEquals
  from sagemaker.workflow.execution_variables import ExecutionVariables
  from sagemaker.workflow.function_step import DelayedReturn, step
  from sagemaker.workflow.functions import JsonGet, Join
  from sagemaker.workflow.parameters import ParameterString
  from sagemaker.workflow.pipeline import Pipeline, PipelineGraph, _replace_pipeline_name_in_json_get_s3_uri
  from sagemaker.workflow.pipeline_context import _PipelineConfig
  from sagemaker.workflow.pipeline_definition_config import PipelineDefinitionConfig
  from sagemaker.workflow.pipeline_experiment_config import PipelineExperimentConfig, PipelineExperimentConfigProperties
  from sagemaker.workflow.step_collections import StepCollection
  from tests.unit.sagemaker.workflow.helpers import ordered, CustomStep, CustomFunctionStep
  from sagemaker.local.local_session import LocalSession
  from botocore.exceptions import ClientError
  from sagemaker.workflow.selective_execution_config import SelectiveExecutionConfig
label_desc: Use image node_id 12 for calling a global function with example usage: test_pipeline_upsert_create_unexpected_failure(sagemaker_session_mock, role_arn) without return types