code: def test_gc_cloud_remove_order(
      tmp_dir, scm, dvc, mocker, local_remote
  ):
      (standalone, dir1, dir2) = tmp_dir.dvc_gen(
          {
              "file1": "standalone",
              "dir1": {"file2": "file2"},
              "dir2": {"file3": "file3", "file4": "file4"},
          }
      )
      dvc.push()
      dvc.remove(standalone.relpath)
      dvc.remove(dir1.relpath)
      dvc.remove(dir2.relpath)
      dvc.gc(workspace=True)
  
      mocked_remove = mocker.patch.object(
          LocalFileSystem, "remove", autospec=True
      )
      dvc.gc(workspace=True, cloud=True)
      assert len(mocked_remove.mock_calls) == 4
      # Unpacked dir should be the first removed
      for args in mocked_remove.call_args_list[:2]:
          checksum = str(args[0][1])
          assert checksum.endswith(".dir.unpacked")
      # Then, bulk remove should be applied
  
      # First to `.dir`
      checksums = mocked_remove.call_args_list[2][0][1]
      assert isinstance(checksums, list)
      assert all(x.endswith(".dir") for x in checksums)
      # And later to individual files
      checksums = mocked_remove.call_args_list[3][0][1]
      assert isinstance(checksums, list)
      assert not any(x.endswith(".dir") for x in checksums)
  
imports: import datetime
  import logging
  import os
  import shutil
  import textwrap
  import pytest
  from dvc.cli import main
  from dvc.exceptions import CollectCacheError, InvalidArgumentError, RevCollectionError
  from dvc.fs import LocalFileSystem
  from dvc.utils.fs import remove
  from dvc_data.hashfile.db.local import LocalHashFileDB
label_desc: Use image node_id 16 for calling a global function with example usage: test_gc_cloud_remove_order(tmp_dir, scm, dvc, mocker, local_remote) without return types