code: def test_list_artifacts_with_subdir(ftp_mock):
      artifact_root_path = "/experiment_id/run_id/"
      repo = FTPArtifactRepository(
          "sftp://test_sftp" + artifact_root_path
      )
  
      repo.get_ftp_client = MagicMock()
      call_mock = MagicMock(return_value=ftp_mock)
      repo.get_ftp_client.return_value = MagicMock(__enter__=call_mock)
  
      # mocked file structure
      #  |- model
      #     |- model.pb
      #     |- variables
      dir_name = "model"
  
      # list artifacts at sub directory level
      file_path = "model.pb"
      file_size = 345
      subdir_name = "variables"
  
      ftp_mock.nlst = MagicMock(return_value=[file_path, subdir_name])
  
      ftp_mock.cwd = MagicMock(
          side_effect=[None, ftplib.error_perm, None]
      )
  
      ftp_mock.size = MagicMock(return_value=file_size)
  
      artifacts = repo.list_artifacts(path=dir_name)
  
      ftp_mock.nlst.assert_called_once_with(
          artifact_root_path + dir_name
      )
      ftp_mock.size.assert_called_once_with(
          artifact_root_path + dir_name + "/" + file_path
      )
  
      assert len(artifacts) == 2
      assert artifacts[0].path == dir_name + "/" + file_path
      assert artifacts[0].is_dir is False
      assert artifacts[0].file_size == file_size
      assert artifacts[1].path == dir_name + "/" + subdir_name
      assert artifacts[1].is_dir is True
      assert artifacts[1].file_size is None
  
imports: import ftplib
  import posixpath
  from ftplib import FTP
  from unittest.mock import MagicMock
  import pytest
  from mlflow.store.artifact.artifact_repository_registry import get_artifact_repository
  from mlflow.store.artifact.ftp_artifact_repo import FTPArtifactRepository
label_desc: Use image node_id 7 for calling a global function with example usage: test_list_artifacts_with_subdir(ftp_mock) without return types