code: def test_partition(
      mock_client,
      mock_is_file,
      mock_model_key_prefix,
      mock_estimator_fit,
      mock_upload,
      mock_s3_list,
      mock_read_file,
      mock_path_exists,
      mock_mkdir,
      mock_create_code_dir,
      mock_tmpdir,
      mock_container_def,
      mock_mktmp,
      mock_name_from_base,
      mock_shutil_rmtree,
      mock_imguri_retrieve,
      sagemaker_session,
  ):
      mock_s3_list.return_value = [
          VALID_UNCOMPRESSED_MODEL_DATA + "/config.json"
      ]
      model_config = {
          "model_type": "bloom",
          "n_heads": 120,
      }
      mock_read_file.return_value = json.dumps(model_config)
      model = DJLModel(
          VALID_UNCOMPRESSED_MODEL_DATA,
          ROLE,
          sagemaker_session=sagemaker_session,
          number_of_partitions=4,
          data_type="fp16",
          container_log_level=logging.DEBUG,
          env=ENV,
      )
  
      assert model.image_uri is None
      mock_is_file.return_value = False
      mock_path_exists.side_effect = [True, False, True]
      mock_mktmp.return_value = "/tmp/dir"
      expected_env = {
          "ENV_VAR": "env_value",
          "SERVING_OPTS": '"-Dai.djl.logging.level=debug"',
      }
      mock_upload.return_value = "s3prefix"
  
      s3_output_uri = f"s3://{BUCKET}/partitions/"
      mock_model_key_prefix.return_value = "s3prefix"
      with patch(
          "builtins.open", mock_open()
      ) as fake_serving_properties:
          model.partition(GPU_INSTANCE, s3_output_uri)
  
          mock_mktmp.assert_called_once_with(
              prefix="tmp", suffix="", dir=None
          )
          mock_mkdir.assert_called()
          assert fake_serving_properties.call_count == 2
          fake_serving_properties.assert_any_call(
              "/tmp/dir/code/serving.properties", "w+"
          )
          fake_serving_properties.assert_any_call(
              "/tmp/dir/code/serving.properties", "r"
          )
          mock_container_def.assert_called_once_with(
              IMAGE_URI, model_data_url="s3prefix", env=expected_env
          )
  
          assert (
              model.model_id
              == f"{s3_output_uri}aot-partitioned-checkpoints"
          )
  
imports: from __future__ import absolute_import
  import logging
  import json
  from json import JSONDecodeError
  import pytest
  from mock import Mock, MagicMock
  from mock import patch, mock_open
  from sagemaker.djl_inference import defaults, DJLModel, DJLPredictor, HuggingFaceAccelerateModel, DeepSpeedModel
  from sagemaker.djl_inference.model import DJLServingEngineEntryPointDefaults
  from sagemaker.s3_utils import s3_path_join
  from sagemaker.session_settings import SessionSettings
  from tests.unit import _test_default_bucket_and_prefix_combinations, DEFAULT_S3_BUCKET_NAME, DEFAULT_S3_OBJECT_KEY_PREFIX_NAME
label_desc: Use image node_id 14 for calling a global function with example usage: test_partition(mock_client, mock_is_file, mock_model_key_prefix, mock_estimator_fit, mock_upload, mock_s3_list, mock_read_file, mock_path_exists, mock_mkdir, mock_create_code_dir, mock_tmpdir, mock_container_def, mock_mktmp, mock_name_from_base, mock_shutil_rmtree, mock_imguri_retrieve, sagemaker_session) without return types