code: def test_list_artifacts(databricks_model_artifact_repo):
      status_code = 200
  
      def _raise_for_status():
          if status_code == 404:
              raise Exception(
                  "404 Client Error: Not Found for url: https://shard-uri/api/2.0/mlflow/model-versions/list-artifacts?name=model&version=1"
              )
  
      list_artifact_dir_response_mock = mock.MagicMock()
      list_artifact_dir_response_mock.status_code = status_code
      list_artifact_dir_json_mock = {
          "files": [
              {"path": "MLmodel", "is_dir": False, "file_size": 294},
              {"path": "data", "is_dir": True, "file_size": None},
          ]
      }
      list_artifact_dir_response_mock.text = json.dumps(
          list_artifact_dir_json_mock
      )
      list_artifact_dir_response_mock.raise_for_status.side_effect = (
          _raise_for_status
      )
      with mock.patch(
          DATABRICKS_MODEL_ARTIFACT_REPOSITORY + "._call_endpoint",
          return_value=list_artifact_dir_response_mock,
      ) as call_endpoint_mock:
          artifacts = databricks_model_artifact_repo.list_artifacts("")
          assert isinstance(artifacts, list)
          assert len(artifacts) == 2
          assert artifacts[0].path == "MLmodel"
          assert artifacts[0].is_dir is False
          assert artifacts[0].file_size == 294
          assert artifacts[1].path == "data"
          assert artifacts[1].is_dir is True
          assert artifacts[1].file_size is None
          call_endpoint_mock.assert_called_once_with(
              ANY, REGISTRY_LIST_ARTIFACTS_ENDPOINT
          )
  
      # errors from API are propagated through to cli response
      list_artifact_dir_bad_response_mock = mock.MagicMock()
      status_code = 404
      list_artifact_dir_bad_response_mock.status_code = status_code
      list_artifact_dir_bad_response_mock.text = "An error occurred"
      list_artifact_dir_bad_response_mock.raise_for_status.side_effect = (
          _raise_for_status
      )
      with mock.patch(
          DATABRICKS_MODEL_ARTIFACT_REPOSITORY + "._call_endpoint",
          return_value=list_artifact_dir_bad_response_mock,
      ) as call_endpoint_mock:
          with pytest.raises(
              MlflowException,
              match=r"API request to list files under path `` failed with status code 404. "
              "Response body: An error occurred",
          ):
              databricks_model_artifact_repo.list_artifacts("")
          call_endpoint_mock.assert_called_once_with(
              ANY, REGISTRY_LIST_ARTIFACTS_ENDPOINT
          )
  
imports: import json
  from unittest import mock
  from unittest.mock import ANY
  import pytest
  from mlflow import MlflowClient
  from mlflow.entities import FileInfo
  from mlflow.entities.model_registry import ModelVersion
  from mlflow.environment_variables import MLFLOW_MULTIPART_DOWNLOAD_CHUNK_SIZE
  from mlflow.exceptions import MlflowException
  from mlflow.store.artifact.databricks_models_artifact_repo import DatabricksModelsArtifactRepository
  from mlflow.utils.file_utils import _Chunk
label_desc: Use image node_id 8 for calling a global function with example usage: test_list_artifacts(databricks_model_artifact_repo) without return types