code: def test_foreach_do_syntax_is_checked_once(tmp_dir, dvc, mocker):
      do_def = {"cmd": "python script.py --epochs ${item}"}
      data = {"foreach": [0, 1, 2, 3, 4], "do": do_def}
      definition = ForeachDefinition(
          DataResolver(dvc, tmp_dir.fs_path, {}),
          Context(),
          "build",
          data,
      )
      mock = mocker.patch(
          "dvc.parsing.check_syntax_errors", return_value=True
      )
      definition.resolve_all()
  
      mock.assert_called_once_with(do_def, "build", "dvc.yaml")
  
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 17 for calling a global function with example usage: test_foreach_do_syntax_is_checked_once(tmp_dir, dvc, mocker) without return types