code: def test_params_file_with_dict_tracked(tmp_dir, dvc):
      foreach_data = {
          "model1": {"thresh": "foo"},
          "model2": {"thresh": "bar"},
      }
      params = {"models": foreach_data}
      (tmp_dir / "params.yaml").dump(params)
  
      resolver = DataResolver(dvc, tmp_dir.fs_path, {})
      data = {
          "foreach": "${models}",
          "do": {"cmd": "echo ${item.thresh}"},
      }
      definition = ForeachDefinition(
          resolver, resolver.context, "build", data
      )
  
      assert definition.resolve_all() == {
          "build@model1": {"cmd": "echo foo"},
          "build@model2": {"cmd": "echo bar"},
      }
      # check that `foreach` item-key replacement didnot leave any leftovers.
      assert resolver.context == {"models": foreach_data}
      assert resolver.tracked_vars == {
          "build@model1": {
              "params.yaml": {"models.model1.thresh": "foo"}
          },
          "build@model2": {
              "params.yaml": {"models.model2.thresh": "bar"}
          },
      }
  
imports: import os
  import pytest
  from dvc.parsing import DEFAULT_PARAMS_FILE, DataResolver, ForeachDefinition
  from dvc.parsing.context import Context
label_desc: Use image node_id 7 for calling a global function with example usage: test_params_file_with_dict_tracked(tmp_dir, dvc) without return types