code: def test_graph(tmp_dir, dvc):
      from dvc.exceptions import CyclicGraphError
  
      tmp_dir.gen({"foo": "foo", "bar": "bar"})
  
      dvc.run(
          deps=["foo"], outs=["bar"], cmd="echo foo > bar", name="1"
      )
  
      dvc.run(
          deps=["bar"], outs=["baz"], cmd="echo bar > baz", name="2"
      )
  
      with pytest.raises(CyclicGraphError):
          dvc.run(
              deps=["baz"], outs=["foo"], cmd="echo baz > foo", name="3"
          )
  
imports: import logging
  import os
  import textwrap
  import uuid
  import pytest
  from funcy import get_in
  from dvc.cli import main
  from dvc.dependency import ParamsDependency
  from dvc.dependency.base import DependencyDoesNotExistError
  from dvc.dvcfile import LOCK_FILE, PROJECT_FILE, load_file
  from dvc.exceptions import ArgumentDuplicationError, CircularDependencyError, CyclicGraphError, InvalidArgumentError, OutputDuplicationError, OverlappingOutputPathsError
  from dvc.stage import PipelineStage
  from dvc.stage.exceptions import DuplicateStageName, InvalidStageName, StagePathNotDirectoryError, StagePathNotFoundError, StagePathOutsideError
  from dvc.utils.serialize import load_yaml
label_desc: Use image node_id 10 for calling a global function with example usage: test_graph(tmp_dir, dvc) without return types