code: def test_diff_top_level_metrics(
      tmp_dir, dvc, scm, dvcfile, metrics_file
  ):
      directory = (tmp_dir / dvcfile).parent
      directory.mkdir(exist_ok=True)
      (tmp_dir / dvcfile).dump({"metrics": [metrics_file]})
  
      metrics_file = directory / metrics_file
      metrics_file.dump({"foo": 3})
      scm.add_commit(
          [metrics_file, tmp_dir / dvcfile], message="add metrics"
      )
  
      metrics_file.dump({"foo": 5})
      assert dvc.metrics.diff() == {
          "diff": {
              relpath(directory / metrics_file): {
                  "foo": {"diff": 2, "new": 5, "old": 3}
              }
          }
      }
  
imports: import json
  from os.path import join
  import pytest
  from dvc.cli import main
  from dvc.utils import relpath
  from dvc.utils.serialize import JSONFileCorruptedError
label_desc: Use image node_id 14 for calling a global function with example usage: test_diff_top_level_metrics(tmp_dir, dvc, scm, dvcfile, metrics_file) without return types