code: def test_params_dump(tmp_dir, dvc, run_head):
      tmp_dir.gen(FS_STRUCTURE)
  
      stage = run_head(
          "foo",
          "bar",
          "foobar",
          name="copy-first-line",
          params=[
              "params2.yaml:answer,lists,name",
              "params.yaml:lists,floats,nested.nested1,nested.nested1.nested2",
          ],
      )
  
      initial_content = read_lock_file()
      lock = initial_content["stages"]["copy-first-line"]
  
      # lock stage key order:
      assert list(lock.keys()) == ["cmd", "deps", "params", "outs"]
      assert list(lock["params"].keys()) == [
          "params.yaml",
          "params2.yaml",
      ]
  
      # # params keys are always sorted by the name
      assert list(lock["params"]["params.yaml"].keys()) == [
          "floats",
          "lists",
          "nested.nested1",
          "nested.nested1.nested2",
      ]
      assert list(lock["params"]["params2.yaml"]) == [
          "answer",
          "lists",
          "name",
      ]
  
      assert not dvc.reproduce(stage.addressing)
  
      # let's change the order of params and dump them in pipeline file
      params, _ = split_params_deps(stage)
      for param in params:
          param.params.reverse()
  
      stage.dvcfile._dump_pipeline_file(stage)
      assert not dvc.reproduce(stage.addressing)
  
      (tmp_dir / LOCK_FILE).unlink()
      assert dvc.reproduce(stage.addressing) == [stage]
      assert_eq_lockfile(initial_content, read_lock_file())
  
      # remove build-cache and check if the same structure is built
      for item in [dvc.stage_cache.cache_dir, LOCK_FILE]:
          remove(item)
      assert dvc.reproduce(stage.addressing) == [stage]
      assert_eq_lockfile(initial_content, read_lock_file())
  
file_path: dvc/tests/func/test_lockfile.py
imports: from collections import OrderedDict
  from operator import itemgetter
  from dvc.dvcfile import LOCK_FILE
  from dvc.stage.utils import split_params_deps
  from dvc.utils.fs import remove
  from dvc.utils.serialize import dumps_yaml, parse_yaml_for_update
  from tests.func.test_run import supported_params
label_desc: Use image node_id 6 for calling a global function with example usage: test_params_dump(tmp_dir, dvc, run_head) without return types