code: def assert_calls(cmd, args=None):
      """Assert that a block of code runs the given command.
  
      If args is passed, also check that it was called at least once with the
      given arguments (not including the command name).
  
      Use as a context manager, e.g.::
  
          with assert_calls('git'):
              some_function_wrapping_git()
  
          with assert_calls('git', ['add', myfile]):
              some_other_function()
      """
      with MockCommand(cmd) as mc:
          yield
  
      mc.assert_called(args=args)
  
file_path: catboost/contrib/python/testpath/py3/testpath/commands.py
imports: import contextlib
  import json
  import os
  import shutil
  import sys
  import tempfile
label_desc: Use image node_id 4 for calling a global function with example usage: assert_calls(cmd, args) without return types