code: def test_get_stages(tmp_dir, dvc, run_copy):
      with pytest.raises(StageFileDoesNotExistError):
          dvc.stage.load_all()
  
      tmp_dir.gen("foo", "foo")
      stage1 = run_copy("foo", "bar", name="copy-foo-bar")
      stage2 = run_copy("bar", "foobar", name="copy-bar-foobar")
  
      assert set(dvc.stage.load_all()) == {stage1, stage2}
      assert set(dvc.stage.load_all(path=PROJECT_FILE)) == {
          stage1,
          stage2,
      }
      assert set(dvc.stage.load_all(name="copy-bar-foobar")) == {stage2}
      assert set(
          dvc.stage.load_all(path=PROJECT_FILE, name="copy-bar-foobar")
      ) == {stage2}
  
      with pytest.raises(StageFileDoesNotExistError):
          dvc.stage.load_all(
              path=relpath(tmp_dir / ".." / PROJECT_FILE)
          )
  
      with pytest.raises(StageNotFound):
          dvc.stage.load_all(path=PROJECT_FILE, name="copy")
  
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 18 for calling a global function with example usage: test_get_stages(tmp_dir, dvc, run_copy) without return types