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