code: def test_filesystems(fs_type):
      fs = fs_type.get_instance()
  
      with tempfile.TemporaryDirectory() as root:
          test1_dir = os.path.join(root, "test1")
          fs.mkdir(test1_dir, create_parents=False)
          test2_dir = os.path.join(root, "test2")
          sub_test2_dir = os.path.join(test2_dir, "sub_test2")
          fs.mkdir(sub_test2_dir)
  
          sub_test2_dir_stat = fs.stat(sub_test2_dir)
          assert sub_test2_dir_stat["type"] == "directory"
          assert sub_test2_dir_stat["name"] == sub_test2_dir
          assert fs.isdir(sub_test2_dir)
  
          test1_file = os.path.join(test1_dir, "test1")
          with fs.open(test1_file, "wb") as f:
              f.write(b"abc test")
          with fs.open(test1_file, "ab") as f:
              f.write(b"\nappend test")
          with fs.open(test1_file, "rb") as f:
              content = f.read()
              with open(test1_file, "rb") as f2:
                  expected = f2.read()
                  assert content == expected
  
          assert fs.cat(test1_file) == expected
  
          assert fs.isfile(test1_file)
          test1_file_stat = fs.stat(test1_file)
          assert test1_file_stat["type"] == "file"
          assert test1_file_stat["name"] == test1_file
          assert test1_file_stat["size"] == os.stat(test1_file).st_size
          np.testing.assert_almost_equal(
              test1_file_stat["modified_time"],
              os.stat(test1_file).st_mtime,
              decimal=6,
          )
  
          walked = [
              (os.path.normpath(root), dirs, files)
              for root, dirs, files in fs.walk(root)
          ]
          expected = os.walk(root)
          assert sorted(walked) == sorted(expected)
  
          test2_file = os.path.join(sub_test2_dir, "test2")
          with fs.open(test2_file, "wb") as f:
              f.write(b"def test")
  
          for recursive in [False, True]:
              globs = [
                  os.path.normpath(p)
                  for p in fs.glob(
                      os.path.join(root, "*"), recursive=recursive
                  )
              ]
              expected = [
                  os.path.normpath(p)
                  for p in _glob.glob(
                      os.path.join(root, "*"), recursive=recursive
                  )
              ]
              assert sorted(globs) == sorted(expected)
  
          for path in [os.path.join(root, "*", "*"), test1_dir]:
              globs = [os.path.normpath(p) for p in fs.glob(path)]
              expected = [os.path.normpath(p) for p in _glob.glob(path)]
              assert sorted(globs) == sorted(expected)
  
          test1_new_file = os.path.join(test1_dir, "test1_new")
          fs.rename(test1_file, test1_new_file)
          test1_new_file2 = os.path.join(test1_dir, "test1_new2")
          fs.mv(test1_new_file, test1_new_file2)
          assert fs.exists(test1_new_file2)
          assert not fs.exists(test1_file)
  
          assert fs.disk_usage(test1_dir) > 0
  
          fs.delete(test2_file)
          assert not fs.exists(test2_file)
  
          assert fs._isfilestore()
  
          with pytest.raises(OSError):
              fs.delete(test1_dir)
          fs.delete(test1_dir, recursive=True)
          assert not fs.exists(test1_dir)
  
file_path: mars/mars/lib/filesystem/tests/test_filesystem.py
imports: import glob
  import os
  import tempfile
  import numpy
  import pytest
  from ....tests.core import require_hadoop
  from ....utils import lazy_import
  from ..None import glob, FileSystem, LocalFileSystem, FSMap
label_desc: Use image node_id 3 for calling a global function with example usage: test_filesystems(fs_type) without return types