code: def test_isolated_cell_with_magic(
      pynb="""# ---
  # title: cell with isolated jupyter magic
  # ---
  
  # A magic command included in a markdown
  # paragraph is code
  #
  # %matplotlib inline
  
  # a code block may start with
  # a magic command, like this one:
  
  # %matplotlib inline
  
  # or that one
  
  # %matplotlib inline
  1 + 1
  """,
  ):
      nb = jupytext.reads(pynb, "py")
  
      assert len(nb.cells) == 6
      assert nb.cells[0].cell_type == "raw"
      assert (
          nb.cells[0].source
          == "---\ntitle: cell with isolated jupyter "
          "magic\n---"
      )
      assert nb.cells[1].cell_type == "code"
      assert nb.cells[2].cell_type == "markdown"
      assert nb.cells[3].cell_type == "code"
      assert nb.cells[3].source == "%matplotlib inline"
      assert nb.cells[4].cell_type == "markdown"
      assert nb.cells[5].cell_type == "code"
      assert nb.cells[5].source == "%matplotlib inline\n1 + 1"
  
      pynb2 = jupytext.writes(nb, "py")
      compare(pynb2, pynb)
  
imports: import pytest
  from nbformat.v4.nbbase import new_code_cell, new_markdown_cell, new_notebook, new_raw_cell
  import jupytext
  from jupytext.compare import compare, compare_notebooks
label_desc: Use image node_id 17 for calling a global function with example usage: test_isolated_cell_with_magic(pynb) without return types