code: def test_mixed_vars_for_foreach_data(tmp_dir, dvc):
      (tmp_dir / "params.yaml").dump({"models": {"model1": "foo"}})
      (tmp_dir / "test_params.yaml").dump({"models": {"model2": "bar"}})
  
      resolver = DataResolver(
          dvc, tmp_dir.fs_path, {"vars": ["test_params.yaml"]}
      )
      data = {"foreach": "${models}", "do": {"cmd": "echo ${item}"}}
      definition = ForeachDefinition(
          resolver, resolver.context, "build", data
      )
  
      assert definition.resolve_all() == {
          "build@model1": {"cmd": "echo foo"},
          "build@model2": {"cmd": "echo bar"},
      }
      assert resolver.context == {
          "models": {"model1": "foo", "model2": "bar"}
      }
      assert resolver.tracked_vars == {
          "build@model1": {"params.yaml": {"models.model1": "foo"}},
          "build@model2": {
              "test_params.yaml": {"models.model2": "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 11 for calling a global function with example usage: test_mixed_vars_for_foreach_data(tmp_dir, dvc) without return types