code: def test_log_artifact_multiple_calls(ftp_mock, tmp_path):
      repo = FTPArtifactRepository("ftp://test_ftp/some/path")
  
      repo.get_ftp_client = MagicMock()
      call_mock = MagicMock(return_value=ftp_mock)
      repo.get_ftp_client.return_value = MagicMock(__enter__=call_mock)
  
      d = tmp_path.joinpath("data")
      d.mkdir()
      file1 = d.joinpath("test1.txt")
      file1.write_text("hello world!")
      fpath1 = d.joinpath("test1.txt")
      fpath1 = str(fpath1)
  
      file2 = d.joinpath("test2.txt")
      file2.write_text("hello world!")
      fpath2 = d.joinpath("test2.txt")
      fpath2 = str(fpath2)
  
      ftp_mock.cwd = MagicMock(
          side_effect=[
              ftplib.error_perm,
              None,
              ftplib.error_perm,
              None,
              None,
              None,
          ]
      )
  
      repo.log_artifact(fpath1)
      ftp_mock.mkd.assert_called_once_with("/some/path")
      ftp_mock.cwd.assert_called_with("/some/path")
      ftp_mock.storbinary.assert_called()
      assert (
          ftp_mock.storbinary.call_args_list[0][0][0]
          == "STOR test1.txt"
      )
      ftp_mock.reset_mock()
  
      repo.log_artifact(fpath1, "subdir")
      ftp_mock.mkd.assert_called_once_with("/some/path/subdir")
      ftp_mock.cwd.assert_called_with("/some/path/subdir")
      ftp_mock.storbinary.assert_called()
      assert (
          ftp_mock.storbinary.call_args_list[0][0][0]
          == "STOR test1.txt"
      )
      ftp_mock.reset_mock()
  
      repo.log_artifact(fpath2)
      ftp_mock.mkd.assert_not_called()
      ftp_mock.cwd.assert_called_with("/some/path")
      ftp_mock.storbinary.assert_called()
      assert (
          ftp_mock.storbinary.call_args_list[0][0][0]
          == "STOR test2.txt"
      )
  
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 9 for calling a global function with example usage: test_log_artifact_multiple_calls(ftp_mock, tmp_path) without return types