code: def test_top_level_plots(
      tmp_dir,
      dvc,
      plot_config,
      expected_datafiles,
  ):
      data = {
          "data1.json": [
              {"a": 1, "b": 0.1, "c": 0.01},
              {"a": 2, "b": 0.2, "c": 0.02},
          ],
          os.path.join("sub", "dir", "data.json"): [
              {"a": 6, "b": 0.6, "c": 0.06},
              {"a": 7, "b": 0.7, "c": 0.07},
          ],
      }
  
      for filename, content in data.items():
          dirname = os.path.dirname(filename)
          if dirname:
              os.makedirs(dirname)
          (tmp_dir / filename).dump_json(content, sort_keys=True)
  
      config_file = "dvc.yaml"
      with modify_yaml(config_file) as dvcfile_content:
          dvcfile_content["plots"] = [plot_config]
  
      result = dvc.plots.show()
  
      assert plot_config == get_plot(
          result, "workspace", typ="definitions", file=config_file
      )
  
      for filename, content in data.items():
          if filename in expected_datafiles:
              assert content == get_plot(
                  result, "workspace", file=filename
              )
          else:
              assert filename not in get_plot(result, "workspace")
  
imports: import json
  import os
  import pytest
  from dvc.cli import main
  from dvc.dvcfile import PROJECT_FILE
  from dvc.exceptions import OverlappingOutputPathsError
  from dvc.repo import Repo
  from dvc.repo.plots import PlotMetricTypeError, onerror_collect
  from dvc.utils.fs import remove
  from dvc.utils.serialize import EncodingError, YAMLFileCorruptedError, modify_yaml
  from tests.utils.plots import get_plot
label_desc: Use image node_id 14 for calling a global function with example usage: test_top_level_plots(tmp_dir, dvc, plot_config, expected_datafiles) without return types