code: def test_foreach_with_interpolated_wdir(tmp_dir, dvc):
      resolver = DataResolver(dvc, (tmp_dir / "data").fs_path, {})
      foreach_data = ["foo", "bar"]
      data = {
          "foreach": foreach_data,
          "do": {"wdir": "${item}", "cmd": "echo hello"},
      }
      definition = ForeachDefinition(
          resolver, resolver.context, "build", data
      )
  
      assert definition.resolve_all() == {
          # note that the resolver generates `wdir` relative to file's wdir
          # so, this is just `foo`, not `data/foo`.
          # figuring out `wdir` is the responsibility of the `load_stage`/`Stage`
          "build@foo": {"wdir": "foo", "cmd": "echo hello"},
          "build@bar": {"wdir": "bar", "cmd": "echo hello"},
      }
  
      assert not resolver.context
      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 13 for calling a global function with example usage: test_foreach_with_interpolated_wdir(tmp_dir, dvc) without return types