From 07f8face8788677552608b6e2b9458aebd8d7d4f Mon Sep 17 00:00:00 2001 From: Marc Wouts Date: Wed, 19 Sep 2018 20:50:43 +0200 Subject: [PATCH] Test sample RISE notebook #66 --- .../ipynb_py/sample_rise_notebook_66.ipynb | 61 +++++++++++++++++++ .../sample_rise_notebook_66.py | 26 ++++++++ .../sample_rise_notebook_66.py | 26 ++++++++ tests/test_contentsmanager.py | 2 +- tests/test_ipynb_to_rmd.py | 2 +- tests/test_mirror.py | 4 +- tests/test_save_multiple.py | 4 +- tests/utils.py | 11 ++-- 8 files changed, 125 insertions(+), 11 deletions(-) create mode 100644 tests/notebooks/ipynb_py/sample_rise_notebook_66.ipynb create mode 100644 tests/notebooks/mirror/ipynb_to_percent/sample_rise_notebook_66.py create mode 100644 tests/notebooks/mirror/ipynb_to_script/sample_rise_notebook_66.py diff --git a/tests/notebooks/ipynb_py/sample_rise_notebook_66.ipynb b/tests/notebooks/ipynb_py/sample_rise_notebook_66.ipynb new file mode 100644 index 000000000..526790883 --- /dev/null +++ b/tests/notebooks/ipynb_py/sample_rise_notebook_66.ipynb @@ -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 +} diff --git a/tests/notebooks/mirror/ipynb_to_percent/sample_rise_notebook_66.py b/tests/notebooks/mirror/ipynb_to_percent/sample_rise_notebook_66.py new file mode 100644 index 000000000..65431bc77 --- /dev/null +++ b/tests/notebooks/mirror/ipynb_to_percent/sample_rise_notebook_66.py @@ -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 diff --git a/tests/notebooks/mirror/ipynb_to_script/sample_rise_notebook_66.py b/tests/notebooks/mirror/ipynb_to_script/sample_rise_notebook_66.py new file mode 100644 index 000000000..990c8b9f1 --- /dev/null +++ b/tests/notebooks/mirror/ipynb_to_script/sample_rise_notebook_66.py @@ -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 diff --git a/tests/test_contentsmanager.py b/tests/test_contentsmanager.py index 272f2fa30..11426c9ed 100644 --- a/tests/test_contentsmanager.py +++ b/tests/test_contentsmanager.py @@ -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' diff --git a/tests/test_ipynb_to_rmd.py b/tests/test_ipynb_to_rmd.py index eecfc8830..1d897c271 100644 --- a/tests/test_ipynb_to_rmd.py +++ b/tests/test_ipynb_to_rmd.py @@ -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, diff --git a/tests/test_mirror.py b/tests/test_mirror.py index dfa37b681..892e3f5ef 100644 --- a/tests/test_mirror.py +++ b/tests/test_mirror.py @@ -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') diff --git a/tests/test_save_multiple.py b/tests/test_save_multiple.py index e2fa1d7a5..5979ade90 100644 --- a/tests/test_save_multiple.py +++ b/tests/test_save_multiple.py @@ -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' @@ -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' diff --git a/tests/utils.py b/tests/utils.py index ebd460cb5..c91bbcee1 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -7,13 +7,13 @@ 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('.'): @@ -21,6 +21,7 @@ def list_notebooks(path='ipynb'): 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