code: def test_list_artifacts(databricks_artifact_repo):
      list_artifact_file_proto_mock = [
          FileInfo(path="a.txt", is_dir=False, file_size=0)
      ]
      list_artifacts_dir_proto_mock = [
          FileInfo(path="test/a.txt", is_dir=False, file_size=100),
          FileInfo(path="test/dir", is_dir=True, file_size=0),
      ]
      list_artifact_response_proto = ListArtifacts.Response(
          root_uri="",
          files=list_artifacts_dir_proto_mock,
          next_page_token=None,
      )
      with mock.patch(
          f"{DATABRICKS_ARTIFACT_REPOSITORY}._call_endpoint",
          return_value=list_artifact_response_proto,
      ):
          artifacts = databricks_artifact_repo.list_artifacts("test/")
          assert isinstance(artifacts, list)
          assert isinstance(artifacts[0], FileInfoEntity)
          assert len(artifacts) == 2
          assert artifacts[0].path == "test/a.txt"
          assert artifacts[0].is_dir is False
          assert artifacts[0].file_size == 100
          assert artifacts[1].path == "test/dir"
          assert artifacts[1].is_dir is True
          assert artifacts[1].file_size is None
  
          # Calling list_artifacts() on a path that's a file should return an empty list
          list_artifact_response_proto = ListArtifacts.Response(
              root_uri="", files=list_artifact_file_proto_mock
          )
      with mock.patch(
          f"{DATABRICKS_ARTIFACT_REPOSITORY}._call_endpoint",
          return_value=list_artifact_response_proto,
      ):
          artifacts = databricks_artifact_repo.list_artifacts("a.txt")
          assert len(artifacts) == 0
  
imports: import json
  import os
  import posixpath
  import re
  import shutil
  import time
  from unittest import mock
  from unittest.mock import ANY
  import pytest
  from requests.models import Response
  from mlflow.entities.file_info import FileInfo
  from mlflow.exceptions import MlflowException
  from mlflow.protos.databricks_artifacts_pb2 import ArtifactCredentialInfo, ArtifactCredentialType, CompleteMultipartUpload, CreateMultipartUpload, GetCredentialsForRead, GetCredentialsForWrite, GetPresignedUploadPartUrl
  from mlflow.protos.service_pb2 import FileInfo, ListArtifacts
  from mlflow.store.artifact.artifact_repository_registry import get_artifact_repository
  from mlflow.store.artifact.databricks_artifact_repo import _MAX_CREDENTIALS_REQUEST_SIZE, DatabricksArtifactRepository
label_desc: Use image node_id 21 for calling a global function with example usage: test_list_artifacts(databricks_artifact_repo) without return types