Skip to content

Commit

Permalink
Update test_read_simple_markdown.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed Sep 21, 2019
1 parent 75c48fd commit 5b90f75
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions tests/test_read_simple_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
<!-- #raw -->
this is a raw cell
<!-- #endraw -->
```R
ls()
```
Expand All @@ -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,
Expand Down Expand Up @@ -155,16 +162,36 @@ 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 {"key": "value"} -->
raw content
```
<!-- #endraw -->
"""):
nb = jupytext.reads(markdown, 'md')
compare(nb.cells[0], new_raw_cell(source='raw content', metadata={'key': 'value'}))
markdown2 = jupytext.writes(nb, 'md')
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="""<!-- #region {"key": "value"} -->
A long
Expand Down

0 comments on commit 5b90f75

Please sign in to comment.