code: def test_pipe_black_uses_warn_only_781(
      tmpdir,
      cwd_tmpdir,
      code,
      black_should_fail,
      python_notebook,
      capsys,
  ):
      nb = python_notebook
      nb.cells.append(new_code_cell(code))
      write(nb, "notebook.ipynb")
  
      if not black_should_fail:
          jupytext(["--pipe", "black", "notebook.ipynb"])
          return
  
      with pytest.raises(SystemExit):
          jupytext(["--pipe", "black", "notebook.ipynb"])
  
      out, err = capsys.readouterr()
      assert "Error: The command 'black -' exited with code" in err
      assert "--warn-only" in err
  
      # With warn-only we just get a warning
      jupytext(["--pipe", "black", "notebook.ipynb", "--warn-only"])
      out, err = capsys.readouterr()
      assert "Warning: The command 'black -' exited with code" in err
  
      # If black fails the notebook should be left unchanged
      actual = read("notebook.ipynb")
      compare_notebooks(actual, nb)
  
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 11 for calling a global function with example usage: test_pipe_black_uses_warn_only_781(tmpdir, cwd_tmpdir, code, black_should_fail, python_notebook, capsys) without return types