code: def test_rename_experiment_by_name(scm, dvc, exp_stage):
      dvc.experiments.run(
          exp_stage.addressing, name="test-name", params=["foo=1"]
      )
      old_ref = exp_refs_by_names(scm, {"test-name"})
      dvc.experiments.rename("new-name", "test-name")
      new_ref = exp_refs_by_names(scm, {"new-name"})
      assert scm.get_ref(str(old_ref["test-name"][0])) is None
      assert scm.get_ref(str(new_ref["new-name"][0])) is not None
      with pytest.raises(UnresolvedExpNamesError):
          dvc.experiments.rename("new-name", "foo")
  
file_path: dvc/tests/func/experiments/test_rename.py
imports: import pytest
  from dvc.exceptions import InvalidArgumentError
  from dvc.repo.experiments.exceptions import ExperimentExistsError, UnresolvedExpNamesError
  from dvc.repo.experiments.utils import exp_refs_by_names
label_desc: Use image node_id 1 for calling a global function with example usage: test_rename_experiment_by_name(scm, dvc, exp_stage) without return types