code: def test_dvcfile_dump_preserves_comments(tmp_dir, dvc):
      text = textwrap.dedent(
          """\
          stages:
            generate-foo:
              cmd: echo foo > foo
              # This copies 'foo' text to 'foo' file.
              outs:
              - foo"""
      )
      tmp_dir.gen("dvc.yaml", text)
      stage = dvc.stage.load_one(name="generate-foo")
      stage.outs[0].use_cache = False
      dvcfile = stage.dvcfile
  
      dvcfile.dump(stage)
      assert dvcfile._load()[1] == (
          text + ":\n\tcache: false\n".expandtabs()
      )
  
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 18 for calling a global function with example usage: test_dvcfile_dump_preserves_comments(tmp_dir, dvc) without return types