Skip to content

Commit

Permalink
test fenced code
Browse files Browse the repository at this point in the history
  • Loading branch information
daizutabi committed Feb 23, 2019
1 parent 8d9a9e2 commit 4cc085a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/jupyter/test_jupyter_converter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import nbformat

from pheasant.jupyter.config import config
from pheasant.jupyter.client import run_cell
from pheasant.jupyter.converter import (cell_runner, initialize,
reload_modules, set_config)
Expand Down Expand Up @@ -39,4 +40,5 @@ def test_set_config():


def test_reload_modules():
config['import_modules'] = ['pandas']
assert reload_modules() is None
8 changes: 8 additions & 0 deletions tests/jupyter/test_renderer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import nbformat
from pheasant.jupyter.renderer import pheasant_options

def test_pheasant_options():
cell = nbformat.v4.new_code_cell('a = 1')
assert pheasant_options(cell) == []
cell.metadata['pheasant'] = {'options': [1, 2, 3]}
assert pheasant_options(cell) == [1, 2, 3]
6 changes: 6 additions & 0 deletions tests/markdown/test_fenced_code_splitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,9 @@ def test_fenced_code_splitter_stream(stream):
assert output.startswith('~~~')
elif k == 10:
assert output == '\n\n```unknown\nabc\n```'


def test_fenced_code_splitter_pheasant_options():
source = '```python\n## inline\na = 1\n```\n'
for output in fenced_code_splitter(source):
assert output[2] == ['inline']

0 comments on commit 4cc085a

Please sign in to comment.