Skip to content

Commit

Permalink
Test sample RISE notebook #66
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed Sep 19, 2018
1 parent fc6dcce commit 07f8fac
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 11 deletions.
61 changes: 61 additions & 0 deletions tests/notebooks/ipynb_py/sample_rise_notebook_66.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"A markdown cell"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"slideshow": {
"slide_type": ""
}
},
"outputs": [],
"source": [
"1+1"
]
},
{
"cell_type": "markdown",
"metadata": {
"cell_style": "center",
"slideshow": {
"slide_type": "fragment"
}
},
"source": [
"Markdown cell two"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
26 changes: 26 additions & 0 deletions tests/notebooks/mirror/ipynb_to_percent/sample_rise_notebook_66.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# ---
# jupyter:
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# language_info:
# codemirror_mode:
# name: ipython
# version: 3
# file_extension: .py
# mimetype: text/x-python
# name: python
# nbconvert_exporter: python
# pygments_lexer: ipython3
# version: 3.6.6
# ---

# %% markdown {"slideshow": {"slide_type": "slide"}}
# A markdown cell

# %% {"slideshow": {"slide_type": ""}}
1+1

# %% markdown {"cell_style": "center", "slideshow": {"slide_type": "fragment"}}
# Markdown cell two
26 changes: 26 additions & 0 deletions tests/notebooks/mirror/ipynb_to_script/sample_rise_notebook_66.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# ---
# jupyter:
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# language_info:
# codemirror_mode:
# name: ipython
# version: 3
# file_extension: .py
# mimetype: text/x-python
# name: python
# nbconvert_exporter: python
# pygments_lexer: ipython3
# version: 3.6.6
# ---

# + {"slideshow": {"slide_type": "slide"}, "cell_type": "markdown"}
A markdown cell

# + {"slideshow": {"slide_type": ""}}
1+1

# + {"cell_style": "center", "slideshow": {"slide_type": "fragment"}, "cell_type": "markdown"}
Markdown cell two
2 changes: 1 addition & 1 deletion tests/test_contentsmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_create_contentsmanager():


@skip_if_dict_is_not_ordered
@pytest.mark.parametrize('nb_file', list_notebooks('ipynb'))
@pytest.mark.parametrize('nb_file', list_notebooks('ipynb', skip='66'))
def test_load_save_rename(nb_file, tmpdir):
tmp_ipynb = 'notebook.ipynb'
tmp_rmd = 'notebook.Rmd'
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ipynb_to_rmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
jupytext.header.INSERT_AND_CHECK_VERSION_NUMBER = False


@pytest.mark.parametrize('nb_file', list_notebooks())
@pytest.mark.parametrize('nb_file', list_notebooks(skip='66'))
def test_identity_source_write_read(nb_file):
"""
Test that writing the notebook with rmd, and read again,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_mirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ def test_Rmd_to_ipynb(nb_file):
assert_conversion_same_as_mirror(nb_file, '.ipynb', 'Rmd_to_ipynb')


@pytest.mark.parametrize('nb_file', list_notebooks('ipynb'))
@pytest.mark.parametrize('nb_file', list_notebooks('ipynb', skip='66'))
def test_ipynb_to_Rmd(nb_file):
assert_conversion_same_as_mirror(nb_file, '.Rmd', 'ipynb_to_Rmd')


@pytest.mark.parametrize('nb_file', list_notebooks('ipynb'))
@pytest.mark.parametrize('nb_file', list_notebooks('ipynb', skip='66'))
def test_ipynb_to_md(nb_file):
assert_conversion_same_as_mirror(nb_file, '.md', 'ipynb_to_md')
4 changes: 2 additions & 2 deletions tests/test_save_multiple.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
jupytext.header.INSERT_AND_CHECK_VERSION_NUMBER = False


@pytest.mark.parametrize('nb_file', list_notebooks())
@pytest.mark.parametrize('nb_file', list_notebooks(skip='66'))
def test_rmd_is_ok(nb_file, tmpdir):
nb = jupytext.readf(nb_file)
tmp_ipynb = 'notebook.ipynb'
Expand Down Expand Up @@ -50,7 +50,7 @@ def test_ipynb_is_ok(nb_file, tmpdir):
compare_notebooks(nb, nb2)


@pytest.mark.parametrize('nb_file', list_notebooks('ipynb_py'))
@pytest.mark.parametrize('nb_file', list_notebooks('ipynb_py', skip='66'))
def test_all_files_created(nb_file, tmpdir):
nb = jupytext.readf(nb_file)
tmp_ipynb = 'notebook.ipynb'
Expand Down
11 changes: 6 additions & 5 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,21 @@
reason="unordered dict result in changes in chunk options")


def list_notebooks(path='ipynb'):
def list_notebooks(path='ipynb', skip=''):
"""All notebooks in the directory notebooks/path,
or in the package itself"""
if path == 'ipynb':
return list_notebooks('ipynb_julia') + \
list_notebooks('ipynb_py') + \
list_notebooks('ipynb_R')
return list_notebooks('ipynb_julia', skip=skip) + \
list_notebooks('ipynb_py', skip=skip) + \
list_notebooks('ipynb_R', skip=skip)

nb_path = os.path.dirname(os.path.abspath(__file__))
if path.startswith('.'):
nb_path = os.path.join(nb_path, path)
else:
nb_path = os.path.join(nb_path, 'notebooks', path)
notebooks = [os.path.join(nb_path, nb_file) for nb_file in
os.listdir(nb_path)]
os.listdir(nb_path) if not skip or skip not in nb_file]

assert notebooks
return notebooks

0 comments on commit 07f8fac

Please sign in to comment.