code: def test_api_with_config_plots(
      tmp_dir, dvc, capsys, repo_with_config_plots
  ):
      repo_state = repo_with_config_plots()
      plots_state = next(repo_state)
  
      plots_data = next(dvc.plots.collect())
  
      assert get_plot(
          plots_data, "workspace", typ="definitions", file="dvc.yaml"
      ) == merge(*plots_state["configs"]["dvc.yaml"])
  
      for file in plots_state["data"]:
          data_source = get_plot(
              plots_data, "workspace", file=file, endkey="data_source"
          )
          assert callable(data_source)
          assert data_source() == {"data": plots_state["data"][file]}
  
imports: import pytest
  from funcy import merge
  from tests.utils.plots import get_plot
label_desc: Use image node_id 2 for calling a global function with example usage: test_api_with_config_plots(tmp_dir, dvc, capsys, repo_with_config_plots) without return types