code: def test_apply_black_through_jupytext(tmpdir, python_notebook):
      # Load real notebook metadata to get the 'auto' extension in --pipe-fmt to work
      metadata = python_notebook.metadata
  
      nb_org = new_notebook(
          cells=[new_code_cell("1        +1", id="cell-id")],
          metadata=metadata,
      )
      nb_black = new_notebook(
          cells=[new_code_cell("1 + 1", id="cell-id")],
          metadata=metadata,
      )
  
      tmp_ipynb = str(
          tmpdir.mkdir("notebook_folder").join("notebook.ipynb")
      )
      tmp_py = str(tmpdir.mkdir("script_folder").join("notebook.py"))
  
      # Black in place
      write(nb_org, tmp_ipynb)
      jupytext([tmp_ipynb, "--pipe", "black"])
      nb_now = read(tmp_ipynb)
      compare_notebooks(nb_now, nb_black, compare_ids=True)
  
      # Write to another folder using dots
      write(nb_org, tmp_ipynb)
      jupytext(
          [
              tmp_ipynb,
              "--to",
              "../script_folder//py:percent",
              "--pipe",
              "black",
          ]
      )
      assert os.path.isfile(tmp_py)
      nb_now = read(tmp_py)
      nb_now.metadata = metadata
      compare_notebooks(nb_now, nb_black)
      os.remove(tmp_py)
  
      # Map to another folder based on file name
      write(nb_org, tmp_ipynb)
      jupytext(
          [
              tmp_ipynb,
              "--from",
              "notebook_folder//ipynb",
              "--to",
              "script_folder//py:percent",
              "--pipe",
              "black",
              "--check",
              "flake8",
          ]
      )
      assert os.path.isfile(tmp_py)
      nb_now = read(tmp_py)
      nb_now.metadata = metadata
      compare_notebooks(nb_now, nb_black)
  
imports: import os
  from copy import deepcopy
  from shutil import copyfile
  import pytest
  from nbformat.v4.nbbase import new_code_cell, new_notebook
  from jupytext import read, write
  from jupytext.cli import jupytext, pipe_notebook, system
  from jupytext.combine import black_invariant
  from jupytext.compare import compare, compare_cells, compare_notebooks
  from jupytext.header import _DEFAULT_NOTEBOOK_METADATA
label_desc: Use image node_id 6 for calling a global function with example usage: test_apply_black_through_jupytext(tmpdir, python_notebook) without return types