Skip to content

Commit

Permalink
More tests on cell_markers=""" (#856)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts authored Sep 22, 2021
1 parent e1c4696 commit 6fa3cab
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/test_cell_markers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from nbformat.v4.nbbase import new_raw_cell

from jupytext import reads, writes
from jupytext.cli import jupytext


def test_set_cell_markers_cli(tmpdir, cwd_tmpdir):
tmpdir.join("test.py").write("# %% [markdown]\n# A Markdown cell\n")
jupytext(["--format-options", 'cell_markers="""', "test.py"])
py = tmpdir.join("test.py").read()
assert py.endswith('# %% [markdown]\n"""\nA Markdown cell\n"""\n')


def test_add_cell_to_script_with_cell_markers(
no_jupytext_version_number,
py='''# ---
# jupyter:
# jupytext:
# formats: py:percent
# cell_markers: '"""'
# ---
''',
):
nb = reads(py, fmt="py:percent")
nb.cells = [new_raw_cell("A raw cell")]
py2 = writes(nb, fmt="py:percent")
assert py2.endswith(
'''# %% [raw]
"""
A raw cell
"""
'''
)

0 comments on commit 6fa3cab

Please sign in to comment.