From 5b90f757e8b52711f840efa4a2d20f309bdbd71f Mon Sep 17 00:00:00 2001 From: Marc Wouts Date: Sat, 21 Sep 2019 19:56:58 +0200 Subject: [PATCH] Update test_read_simple_markdown.py #321 --- tests/test_read_simple_markdown.py | 35 ++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/tests/test_read_simple_markdown.py b/tests/test_read_simple_markdown.py index 551805475..e5883edfb 100644 --- a/tests/test_read_simple_markdown.py +++ b/tests/test_read_simple_markdown.py @@ -19,9 +19,13 @@ def test_read_mostly_py_markdown_file(markdown="""--- ``` ``` -# this is a raw cell +# this is a code cell with no language info ``` + +this is a raw cell + + ```R ls() ``` @@ -46,9 +50,12 @@ def test_read_mostly_py_markdown_file(markdown="""--- 'execution_count': None, 'source': 'x = np.arange(0,1,eps)\ny = np.abs(x)-.5', 'outputs': []}, + {'cell_type': 'markdown', + 'metadata': {}, + 'source': '```\n# this is a code cell with no language info\n```'}, {'cell_type': 'raw', 'metadata': {}, - 'source': '# this is a raw cell'}, + 'source': 'this is a raw cell'}, {'cell_type': 'code', 'metadata': {}, 'execution_count': None, @@ -155,9 +162,9 @@ def test_code_cell_with_metadata(markdown="""```python tags=["parameters"] compare(markdown, markdown2) -def test_raw_cell_with_metadata(markdown="""```key="value" +def test_raw_cell_with_metadata(markdown=""" raw content -``` + """): nb = jupytext.reads(markdown, 'md') compare(nb.cells[0], new_raw_cell(source='raw content', metadata={'key': 'value'})) @@ -165,6 +172,26 @@ def test_raw_cell_with_metadata(markdown="""```key="value" compare(markdown, markdown2) +def test_read_raw_cell_markdown_version_1_1(markdown="""--- +jupyter: + jupytext: + text_representation: + extension: .md + format_name: markdown + format_version: '1.1' + jupytext_version: 1.1.0 +--- + +```key="value" +raw content +``` +"""): + nb = jupytext.reads(markdown, 'md') + compare(nb.cells[0], new_raw_cell(source='raw content', metadata={'key': 'value'})) + md2 = jupytext.writes(nb, 'md') + assert "format_version: '1.1'" not in md2 + + def test_markdown_cell_with_metadata(markdown=""" A long