-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
32 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,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) |