code: def test_metadata_and_cell_to_header(no_jupytext_version_number):
      metadata = {"jupytext": {"mainlanguage": "python"}}
      nb = new_notebook(
          metadata=metadata,
          cells=[new_raw_cell(source="---\ntitle: Sample header\n---")],
      )
      header, lines_to_next_cell = metadata_and_cell_to_header(
          nb,
          metadata,
          get_format_implementation(".md"),
          {"extension": ".md"},
      )
      assert (
          "\n".join(header)
          == """---
  title: Sample header
  jupyter:
    jupytext:
      mainlanguage: python
  ---"""
      )
      assert nb.cells == []
      assert lines_to_next_cell is None
  
file_path: jupytext/tests/unit/test_header.py
imports: from nbformat.v4.nbbase import new_markdown_cell, new_notebook, new_raw_cell
  import jupytext
  from jupytext.compare import compare
  from jupytext.formats import get_format_implementation
  from jupytext.header import header_to_metadata_and_cell, metadata_and_cell_to_header, uncomment_line
label_desc: Use image node_id 5 for calling a global function with example usage: test_metadata_and_cell_to_header(no_jupytext_version_number) without return types