code: def test_get_stage(tmp_dir, dvc, run_copy):
      tmp_dir.gen("foo", "foo")
      stage1 = run_copy("foo", "bar", name="copy-foo-bar")
  
      with pytest.raises(StageNameUnspecified):
          dvc.stage.load_one()
  
      with pytest.raises(StageNameUnspecified):
          dvc.stage.load_one(path=PROJECT_FILE)
  
      assert (
          dvc.stage.load_one(path=PROJECT_FILE, name="copy-foo-bar")
          == stage1
      )
      assert dvc.stage.load_one(name="copy-foo-bar") == stage1
  
      with pytest.raises(StageFileDoesNotExistError):
          dvc.stage.load_one(path="something.yaml", name="name")
  
      with pytest.raises(StageNotFound):
          dvc.stage.load_one(name="random_name")
  
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 20 for calling a global function with example usage: test_get_stage(tmp_dir, dvc, run_copy) without return types