code: def test_collect_granular_with_deps(tmp_dir, dvc, stages):
      assert set(
          map(
              itemgetter(0),
              dvc.stage.collect_granular(
                  "copy-foo-bar", with_deps=True
              ),
          )
      ) == {stages["copy-foo-bar"], stages["foo-generate"]}
      assert set(
          map(
              itemgetter(0),
              dvc.stage.collect_granular(
                  "copy-bar-foobar", with_deps=True
              ),
          )
      ) == {
          stages["copy-bar-foobar"],
          stages["copy-foo-bar"],
          stages["foo-generate"],
      }
      assert set(
          map(
              itemgetter(0),
              dvc.stage.collect_granular(PROJECT_FILE, with_deps=True),
          )
      ) == set(stages.values())
  
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 13 for calling a global function with example usage: test_collect_granular_with_deps(tmp_dir, dvc, stages) without return types