Skip to content

Commit

Permalink
Reproduce empty cell issue #53
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed Sep 5, 2018
1 parent 6b0c9fd commit 4c67f33
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/test_preserve_empty_cells.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import pytest
from testfixtures import compare
from nbformat.v4.nbbase import new_notebook, new_code_cell, new_markdown_cell
import jupytext

jupytext.file_format_version.FILE_FORMAT_VERSION = {}


@pytest.mark.parametrize('blank_lines', range(1, 6))
def test_file_with_blank_lines(blank_lines):
py_script = """# Markdown cell{0}
# Another one{0}
""".format('\n'.join([''] * blank_lines))

notebook = jupytext.reads(py_script, ext='.py')
py_script2 = jupytext.writes(notebook, ext='.py')
compare(py_script, py_script2)


@pytest.mark.skip(reason='#53')
@pytest.mark.parametrize('blank_cells', range(1, 3))
def test_notebook_with_empty_cells(blank_cells):
notebook = new_notebook(cells=[new_markdown_cell('markdown cell one')] +
[new_code_cell('')] * blank_cells +
[new_markdown_cell('markdown cell two')] +
[new_code_cell('')] * blank_cells,
metadata={'main_language': 'python'})

script = jupytext.writes(notebook, ext='.py')
notebook2 = jupytext.reads(script, ext='.py')

compare(notebook, notebook2)

0 comments on commit 4c67f33

Please sign in to comment.