code: def test_is_protected(tmp_dir, dvc, link_name):
      odb = dvc.cache.local
      fs = odb.fs
      link_method = getattr(fs, link_name)
  
      (tmp_dir / "foo").write_text("foo")
  
      foo = tmp_dir / "foo"
      link = tmp_dir / "link"
  
      link_method(foo, link)
  
      assert not odb.is_protected(foo)
      assert not odb.is_protected(link)
  
      odb.protect(foo)
  
      assert odb.is_protected(foo)
      assert odb.is_protected(link)
  
      odb.unprotect(link)
  
      assert not odb.is_protected(link)
      if os.name == "nt" and link_name == "hardlink":
          # NOTE: NTFS doesn't allow deleting read-only files, which forces us to
          # set write perms on the link, which propagates to the source.
          assert not odb.is_protected(foo)
      else:
          assert odb.is_protected(foo)
  
file_path: dvc/tests/unit/data/db/test_local.py
imports: import errno
  import os
  import pytest
  from dvc.fs import LocalFileSystem
  from dvc_data.hashfile.db.local import LocalHashFileDB
  from dvc_data.hashfile.hash_info import HashInfo
label_desc: Use image node_id 2 for calling a global function with example usage: test_is_protected(tmp_dir, dvc, link_name) without return types