code: def test_remove(tmp_dir, scm, dvc, run_copy, remove_outs):
      (stage1,) = tmp_dir.dvc_gen("foo", "foo")
      stage2 = run_copy("foo", "bar", name="copy-foo-bar")
      stage3 = run_copy("bar", "foobar", name="copy-bar-foobar")
  
      assert "/foo" in get_gitignore_content()
      assert "/bar" in get_gitignore_content()
      assert "/foobar" in get_gitignore_content()
  
      for stage in [stage1, stage2, stage3]:
          dvc.remove(stage.addressing, outs=remove_outs)
          out_exists = (out.exists for out in stage.outs)
          assert stage not in dvc.index.stages
          if remove_outs:
              assert not any(out_exists)
          else:
              assert all(out_exists)
  
      assert not (tmp_dir / ".gitignore").exists()
  
file_path: dvc/tests/func/test_remove.py
imports: import os
  import pytest
  from dvc.cli import main
  from dvc.fs import system
  from dvc.stage.exceptions import StageFileDoesNotExistError, StageFileIsNotDvcFileError
  from dvc.utils.fs import remove
  from dvc_objects.errors import ObjectDBError
  from tests.utils import get_gitignore_content
label_desc: Use image node_id 1 for calling a global function with example usage: test_remove(tmp_dir, scm, dvc, run_copy, remove_outs) without return types