code: def test_manual_call_of_pre_commit_hook(tmpdir):
      tmp_ipynb = str(tmpdir.join("notebook.ipynb"))
      tmp_py = str(tmpdir.join("notebook.py"))
      nb = new_notebook(cells=[])
      os.chdir(str(tmpdir))
  
      git = git_in_tmpdir(tmpdir)
  
      def hook():
          with mock.patch(
              "jupytext.cli.system", system_in_tmpdir(tmpdir)
          ):
              jupytext(["--to", "py", "--pre-commit"])
  
      write(nb, tmp_ipynb)
      assert os.path.isfile(tmp_ipynb)
      assert not os.path.isfile(tmp_py)
  
      git("add", "notebook.ipynb")
      git("status")
      hook()
      git("commit", "-m", "created")
      git("status")
  
      assert "notebook.py" in git(
          "ls-tree", "-r", "main", "--name-only"
      )
      assert os.path.isfile(tmp_py)
  
file_path: jupytext/tests/external/pre_commit/test_pre_commit_scripts.py
imports: import os
  import stat
  import unittest.mock
  import pytest
  from nbformat.v4.nbbase import new_code_cell, new_markdown_cell, new_notebook
  from jupytext import read, write
  from jupytext.cli import jupytext, system
  from jupytext.compare import compare_cells, compare_notebooks
label_desc: Use image node_id 8 for calling a global function with example usage: test_manual_call_of_pre_commit_hook(tmpdir) without return types