code: def test_remove_stage(tmp_dir, dvc, run_copy):
      tmp_dir.gen("foo", "foo")
      stage = run_copy("foo", "bar", name="copy-foo-bar")
      stage2 = run_copy("bar", "foobar", name="copy-bar-foobar")
  
      dvc_file = load_file(dvc, PROJECT_FILE)
      assert dvc_file.exists()
      assert {"copy-bar-foobar", "copy-foo-bar"} == set(
          dvc_file._load()[0]["stages"].keys()
      )
  
      dvc_file.remove_stage(stage)
  
      assert ["copy-bar-foobar"] == list(
          dvc_file._load()[0]["stages"].keys()
      )
  
      # sanity check
      stage2.reload()
  
      # re-check to see if it fails if there's no stage entry
      dvc_file.remove_stage(stage)
      dvc_file.remove(force=True)
      # should not fail when there's no file at all.
      dvc_file.remove_stage(stage)
  
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 10 for calling a global function with example usage: test_remove_stage(tmp_dir, dvc, run_copy) without return types