code: def test_copy_files(tmpdir):
      """Test that the `test_copy_files` utility can handle both files and folders when the destination does not
      exist."""
      # copy from a src that does not exist
      src = pathlib.Path(tmpdir, "dir1")
      dst = pathlib.Path(tmpdir, "dir2")
      with pytest.raises(FileNotFoundError):
          _copy_files(src, dst)
  
      # copy to a dst dir that does not exist
      src.mkdir()
      (src / "empty.txt").touch()
      assert not dst.exists()
      _copy_files(src, dst)
      assert dst.is_dir()
  
      # copy to a destination dir that already exists (no error should be raised)
      _copy_files(src, dst)
      assert dst.is_dir()
  
      # copy file to a dst that does not exist
      src = pathlib.Path(tmpdir, "dir3", "src-file.txt")
      dst = pathlib.Path(tmpdir, "dir4", "dst-file.txt")
      src.parent.mkdir(parents=True)
      src.touch()
      assert not dst.exists()
      _copy_files(src, dst)
      assert dst.is_file()
  
file_path: pytorch-lightning/tests/tests_app/storage/test_copier.py
imports: import os
  import pathlib
  from unittest import mock
  from unittest.mock import Mock
  import lightning.app
  import pytest
  from lightning.app.storage.copier import _Copier, _copy_files
  from lightning.app.storage.path import Path
  from lightning.app.storage.requests import _ExistsRequest, _GetRequest
  from lightning.app.testing.helpers import _MockQueue
label_desc: Use image node_id 4 for calling a global function with example usage: test_copy_files(tmpdir) without return types