code: def test_collect_granular_same_output_name_stage_name(
      tmp_dir, dvc, run_copy
  ):
      (stage1,) = tmp_dir.dvc_gen("foo", "foo")
      (stage2,) = tmp_dir.dvc_gen("copy-foo-bar", "copy-foo-bar")
      stage3 = run_copy("foo", "bar", name="copy-foo-bar")
  
      assert dvc.stage.collect_granular("copy-foo-bar") == [
          (stage3, None)
      ]
  
      coll = dvc.stage.collect_granular("copy-foo-bar", with_deps=True)
      assert set(map(itemgetter(0), coll)) == {stage3, stage1}
      assert list(map(itemgetter(1), coll)) == [None] * 2
  
      assert dvc.stage.collect_granular("./copy-foo-bar") == [
          (stage2, os.path.join(tmp_dir / "copy-foo-bar"))
      ]
      assert dvc.stage.collect_granular(
          "./copy-foo-bar", with_deps=True
      ) == [(stage2, os.path.join(tmp_dir / "copy-foo-bar"))]
  
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 14 for calling a global function with example usage: test_collect_granular_same_output_name_stage_name(tmp_dir, dvc, run_copy) without return types