Skip to content

Commit

Permalink
Raw cells with metadata transition from Jupytext Markdown 1.1 to 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed Oct 27, 2019
1 parent 710d51b commit b88ea4d
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/test_read_simple_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,42 @@ def test_read_raw_cell_markdown_version_1_1(markdown="""---
assert "format_version: '1.1'" not in md2


def test_read_raw_cell_markdown_version_1_1_with_mimetype(header="""---
jupyter:
jupytext:
text_representation:
extension: .md
format_name: markdown
format_version: '1.1'
jupytext_version: 1.1.0-rc0
kernelspec:
display_name: Python 3
language: python
name: python3
---
""", markdown_11="""```raw_mimetype="text/restructuredtext"
.. meta::
:description: Topic: Integrated Development Environments, Difficulty: Easy, Category: Tools
:keywords: python, introduction, IDE, PyCharm, VSCode, Jupyter, recommendation, tools
```
""", markdown_12="""<!-- #raw raw_mimetype="text/restructuredtext" -->
.. meta::
:description: Topic: Integrated Development Environments, Difficulty: Easy, Category: Tools
:keywords: python, introduction, IDE, PyCharm, VSCode, Jupyter, recommendation, tools
<!-- #endraw -->
"""):
nb = jupytext.reads(header + '\n' + markdown_11, 'md')
compare(nb.cells[0], new_raw_cell(source=""".. meta::
:description: Topic: Integrated Development Environments, Difficulty: Easy, Category: Tools
:keywords: python, introduction, IDE, PyCharm, VSCode, Jupyter, recommendation, tools""",
metadata={'raw_mimetype': 'text/restructuredtext'}))
md2 = jupytext.writes(nb, 'md')
assert "format_version: '1.1'" not in md2
nb.metadata['jupytext']['notebook_metadata_filter'] = '-all'
md2 = jupytext.writes(nb, 'md')
compare(md2, markdown_12)


def test_markdown_cell_with_metadata_json(markdown="""<!-- #region {"key": "value"} -->
A long
Expand Down

0 comments on commit b88ea4d

Please sign in to comment.