code: def test_jumpstart_common_script_uri(
      patched_get_model_specs,
      patched_verify_model_region_and_return_specs,
  ):
      patched_verify_model_region_and_return_specs.side_effect = (
          verify_model_region_and_return_specs
      )
      patched_get_model_specs.side_effect = get_spec_from_base_spec
  
      mock_client = boto3.client("s3")
      mock_session = Mock(s3_client=mock_client)
  
      script_uris.retrieve(
          script_scope="training",
          model_id="pytorch-ic-mobilenet-v2",
          model_version="*",
          sagemaker_session=mock_session,
      )
      patched_get_model_specs.assert_called_once_with(
          region=sagemaker_constants.JUMPSTART_DEFAULT_REGION_NAME,
          model_id="pytorch-ic-mobilenet-v2",
          version="*",
          s3_client=mock_client,
      )
      patched_verify_model_region_and_return_specs.assert_called_once()
  
      patched_get_model_specs.reset_mock()
      patched_verify_model_region_and_return_specs.reset_mock()
  
      script_uris.retrieve(
          script_scope="inference",
          model_id="pytorch-ic-mobilenet-v2",
          model_version="1.*",
          sagemaker_session=mock_session,
      )
      patched_get_model_specs.assert_called_once_with(
          region=sagemaker_constants.JUMPSTART_DEFAULT_REGION_NAME,
          model_id="pytorch-ic-mobilenet-v2",
          version="1.*",
          s3_client=mock_client,
      )
      patched_verify_model_region_and_return_specs.assert_called_once()
  
      patched_get_model_specs.reset_mock()
      patched_verify_model_region_and_return_specs.reset_mock()
  
      script_uris.retrieve(
          region="us-west-2",
          script_scope="training",
          model_id="pytorch-ic-mobilenet-v2",
          model_version="*",
          sagemaker_session=mock_session,
      )
      patched_get_model_specs.assert_called_once_with(
          region="us-west-2",
          model_id="pytorch-ic-mobilenet-v2",
          version="*",
          s3_client=mock_client,
      )
      patched_verify_model_region_and_return_specs.assert_called_once()
  
      patched_get_model_specs.reset_mock()
      patched_verify_model_region_and_return_specs.reset_mock()
  
      script_uris.retrieve(
          region="us-west-2",
          script_scope="inference",
          model_id="pytorch-ic-mobilenet-v2",
          model_version="1.*",
          sagemaker_session=mock_session,
      )
      patched_get_model_specs.assert_called_once_with(
          region="us-west-2",
          model_id="pytorch-ic-mobilenet-v2",
          version="1.*",
          s3_client=mock_client,
      )
      patched_verify_model_region_and_return_specs.assert_called_once()
  
      with pytest.raises(NotImplementedError):
          script_uris.retrieve(
              region="us-west-2",
              script_scope="BAD_SCOPE",
              model_id="pytorch-ic-mobilenet-v2",
              model_version="*",
          )
  
      with pytest.raises(KeyError):
          script_uris.retrieve(
              region="us-west-2",
              script_scope="training",
              model_id="blah",
              model_version="*",
          )
  
      with pytest.raises(ValueError):
          script_uris.retrieve(
              region="mars-south-1",
              script_scope="training",
              model_id="pytorch-ic-mobilenet-v2",
              model_version="*",
          )
  
      with pytest.raises(ValueError):
          script_uris.retrieve(
              model_id="pytorch-ic-mobilenet-v2",
              model_version="*",
          )
  
      with pytest.raises(ValueError):
          script_uris.retrieve(
              script_scope="training",
              model_version="*",
          )
  
      with pytest.raises(ValueError):
          script_uris.retrieve(
              script_scope="training",
              model_id="pytorch-ic-mobilenet-v2",
          )
  
file_path: sagemaker-python-sdk/tests/unit/sagemaker/script_uris/jumpstart/test_common.py
imports: from __future__ import absolute_import
  from unittest.mock import Mock
  import pytest
  import boto3
  from mock.mock import patch
  from sagemaker import script_uris
  from sagemaker.jumpstart.utils import verify_model_region_and_return_specs
  from tests.unit.sagemaker.jumpstart.utils import get_spec_from_base_spec
  from sagemaker.jumpstart import constants
label_desc: Use image node_id 1 for calling a global function with example usage: test_jumpstart_common_script_uri(patched_get_model_specs, patched_verify_model_region_and_return_specs) without return types