Skip to content

Commit

Permalink
Reproduce #365 with a test
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed Oct 30, 2019
1 parent 4d6bef1 commit c66a50b
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/test_read_simple_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,3 +590,34 @@ def test_two_markdown_cell_with_no_language_code_works(nb=new_notebook(cells=[
text = jupytext.writes(nb, 'md')
nb2 = jupytext.reads(text, 'md')
compare_notebooks(nb2, nb)


def test_notebook_with_python3_magic(no_jupytext_version_number,
nb=new_notebook(metadata={
'kernelspec': {'display_name': 'Python 3', 'language': 'python',
'name': 'python3'}},
cells=[new_code_cell('%%python2\na = 1\nprint a'),
new_code_cell('%%python3\nb = 2\nprint(b)')]),
text="""---
jupyter:
kernelspec:
display_name: Python 3
language: python
name: python3
---
```python2
a = 1
print a
```
```python3
b = 2
print(b)
```
"""):
md = jupytext.writes(nb, 'md')
compare(md, text)

nb2 = jupytext.reads(md, 'md')
compare_notebooks(nb2, nb)

0 comments on commit c66a50b

Please sign in to comment.