-
Notifications
You must be signed in to change notification settings - Fork 391
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More tests on cell_markers=""" (#856)
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
""" | ||
''' | ||
) |