code: def test_foreach_interpolate_with_composite_data(
      tmp_dir, dvc, foreach_def, foreach_data, result
  ):
      vars_ = [{"models": foreach_data}]
      resolver = DataResolver(dvc, tmp_dir.fs_path, {"vars": vars_})
      data = {
          "foreach": "${models}",
          "do": {"cmd": f"echo {foreach_def}"},
      }
      definition = ForeachDefinition(
          resolver, resolver.context, "build", data
      )
  
      assert definition.resolve_all() == result
      assert resolver.context == {"models": foreach_data}
      assert not any(item for item in resolver.tracked_vars.values())
  
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 6 for calling a global function with example usage: test_foreach_interpolate_with_composite_data(tmp_dir, dvc, foreach_def, foreach_data, result) without return types