code: def test_write_preserves_user_directory(
      num_rows, tmp_path, ray_start_regular_shared
  ):
      ds = ray.data.range(num_rows)
      path = os.path.join(tmp_path, "test")
      os.mkdir(path)  # User-created directory
  
      ds.write_datasource(MockFileDatasink(path=path))
  
      assert os.path.isdir(path)
  
imports: import os
  from typing import Any, Dict
  import pyarrow
  import pytest
  from pyarrow.fs import LocalFileSystem
  import ray
  from ray.data.block import BlockAccessor
  from ray.data.datasource import BlockBasedFileDatasink, RowBasedFileDatasink
label_desc: Use image node_id 5 for calling a global function with example usage: test_write_preserves_user_directory(num_rows, tmp_path, ray_start_regular_shared) without return types