code: def test_force_comment_using_contents_manager(tmpdir):
      tmp_py = "notebook.py"
  
      cm = jupytext.TextFileContentsManager()
      cm.preferred_jupytext_formats_save = "py:percent"
      cm.root_dir = str(tmpdir)
  
      nb = new_notebook(cells=[new_code_cell("%pylab inline")])
  
      cm.save(model=notebook_model(nb), path=tmp_py)
      with open(str(tmpdir.join(tmp_py))) as stream:
          assert "# %pylab inline" in stream.read().splitlines()
  
      cm.comment_magics = False
      cm.save(model=notebook_model(nb), path=tmp_py)
      with open(str(tmpdir.join(tmp_py))) as stream:
          assert "%pylab inline" in stream.read().splitlines()
  
imports: import pytest
  from nbformat.v4.nbbase import new_code_cell, new_notebook
  import jupytext
  from jupytext.compare import compare, compare_notebooks, notebook_model
  from jupytext.magics import _PYTHON_MAGIC_ASSIGN, comment_magic, is_magic, uncomment_magic, unesc
label_desc: Use image node_id 10 for calling a global function with example usage: test_force_comment_using_contents_manager(tmpdir) without return types