code: def test_download_artifacts_does_not_infinitely_loop(
      base_uri, download_arg, list_return_val
  ):
      def list_artifacts(path):
          fullpath = posixpath.join(base_uri, path)
          if fullpath.endswith(_MODEL_DIR) or fullpath.endswith(
              _MODEL_DIR + "/"
          ):
              return [
                  FileInfo(item, False, _DUMMY_FILE_SIZE)
                  for item in list_return_val
              ]
          elif fullpath.endswith(
              _PARENT_MODEL_DIR
          ) or fullpath.endswith(_PARENT_MODEL_DIR + "/"):
              return [
                  FileInfo(
                      posixpath.join(path, _MODEL_DIR),
                      True,
                      _EMPTY_FILE_SIZE,
                  )
              ]
          else:
              return []
  
      with mock.patch.object(
          ArtifactRepositoryImpl, "list_artifacts"
      ) as list_artifacts_mock:
          list_artifacts_mock.side_effect = list_artifacts
          repo = ArtifactRepositoryImpl(base_uri)
          repo.download_artifacts(download_arg)
  
imports: import posixpath
  import time
  from unittest import mock
  import pytest
  from mlflow.entities import FileInfo
  from mlflow.exceptions import MlflowException
  from mlflow.store.artifact.artifact_repo import ArtifactRepository
  from mlflow.utils.file_utils import TempDir
label_desc: Use image node_id 1 for calling a global function with example usage: test_download_artifacts_does_not_infinitely_loop(base_uri, download_arg, list_return_val) and returns: unknown, list, list