code: def test_has_stage_with_name(tmp_dir, dvc):
      tmp_dir.gen("foo", "foo")
      dvc.run(
          cmd="cp foo foo2",
          deps=["foo"],
          name="copy-foo-foo2",
          metrics=["foo2"],
          always_changed=True,
      )
      dvcfile = load_file(dvc, PROJECT_FILE)
      assert "copy-foo-foo2" in dvcfile.stages
      assert "copy" not in dvcfile.stages
  
imports: import textwrap
  import pytest
  from dvc.annotations import Annotation
  from dvc.dvcfile import LOCK_FILE, PROJECT_FILE, ParametrizedDumpError, SingleStageFile, load_file
  from dvc.stage.exceptions import StageFileDoesNotExistError
  from dvc.stage.loader import StageNotFound
  from dvc.utils.strictyaml import YAMLValidationError
label_desc: Use image node_id 5 for calling a global function with example usage: test_has_stage_with_name(tmp_dir, dvc) without return types