code: def test_gitignored_file_try_collect_granular_for_data_files(
      tmp_dir, dvc, scm
  ):
      (stage,) = tmp_dir.dvc_gen({"data": {"foo": "foo", "bar": "bar"}})
      path = os.path.join("data", "foo")
  
      assert dvc.stage.collect_granular(path) == [
          (stage, os.path.join(tmp_dir, path))
      ]
  
      scm.ignore(stage.path)
      dvc._reset()
  
      with pytest.raises(NoOutputOrStageError):
          dvc.stage.collect_granular(path)
  
imports: import os
  from operator import itemgetter
  import pytest
  from funcy import raiser
  from dvc.dvcfile import PROJECT_FILE, FileIsGitIgnored
  from dvc.exceptions import NoOutputOrStageError
  from dvc.repo import Repo
  from dvc.stage.exceptions import StageFileDoesNotExistError, StageNameUnspecified, StageNotFound
  from dvc.utils import relpath
  from dvc.utils.fs import remove
  from dvc.utils.strictyaml import YAMLValidationError
label_desc: Use image node_id 25 for calling a global function with example usage: test_gitignored_file_try_collect_granular_for_data_files(tmp_dir, dvc, scm) without return types