code: def test_jumpstart_default_metric_definitions(
      patched_get_model_specs,
  ):
      patched_get_model_specs.side_effect = get_spec_from_base_spec
  
      mock_client = boto3.client("s3")
      mock_session = Mock(s3_client=mock_client)
  
      model_id = "pytorch-ic-mobilenet-v2"
      region = "us-west-2"
  
      definitions = metric_definitions.retrieve_default(
          region=region,
          model_id=model_id,
          model_version="*",
          sagemaker_session=mock_session,
      )
      assert definitions == [
          {
              "Regex": "val_accuracy: ([0-9\\.]+)",
              "Name": "pytorch-ic:val-accuracy",
          }
      ]
  
      patched_get_model_specs.assert_called_once_with(
          region=region,
          model_id=model_id,
          version="*",
          s3_client=mock_client,
      )
  
      patched_get_model_specs.reset_mock()
  
      definitions = metric_definitions.retrieve_default(
          region=region,
          model_id=model_id,
          model_version="1.*",
          sagemaker_session=mock_session,
      )
      assert definitions == [
          {
              "Regex": "val_accuracy: ([0-9\\.]+)",
              "Name": "pytorch-ic:val-accuracy",
          }
      ]
  
      patched_get_model_specs.assert_called_once_with(
          region=region,
          model_id=model_id,
          version="1.*",
          s3_client=mock_client,
      )
  
      patched_get_model_specs.reset_mock()
  
      with pytest.raises(KeyError):
          metric_definitions.retrieve_default(
              region=region,
              model_id="blah",
              model_version="*",
          )
  
      with pytest.raises(ValueError):
          metric_definitions.retrieve_default(
              region="mars-south-1",
              model_id=model_id,
              model_version="*",
          )
  
      with pytest.raises(ValueError):
          metric_definitions.retrieve_default(
              model_version="*",
          )
  
      with pytest.raises(ValueError):
          metric_definitions.retrieve_default(
              model_id=model_id,
          )
  
file_path: sagemaker-python-sdk/tests/unit/sagemaker/metric_definitions/jumpstart/test_default.py
imports: from __future__ import absolute_import
  from unittest.mock import Mock
  import boto3
  from mock.mock import patch
  import pytest
  from sagemaker import metric_definitions
  from tests.unit.sagemaker.jumpstart.utils import get_spec_from_base_spec, get_special_model_spec
label_desc: Use image node_id 1 for calling a global function with example usage: test_jumpstart_default_metric_definitions(patched_get_model_specs) without return types