#!/usr/bin/env python
# -*- coding: utf-8 -*-
r"""
Sphinx Gallery Notebook converter
=================================

Exposes the Sphinx-Gallery Notebook renderer to directly convert Python
scripts into Jupyter Notebooks.

"""
# Author: Óscar Nájera
# License: 3-clause BSD

from __future__ import division, absolute_import, print_function

from sphinx_gallery.notebook import python_to_jupyter_cli


if __name__ == '__main__':
    python_to_jupyter_cli()
def test_missing_file():
    """ User passes non existing file, should fail with FileNotFoundError """
    with pytest.raises(FileNotFoundError) as excinfo:
        python_to_jupyter_cli(['nofile.py'])
    excinfo.match(r'No such file or directory.+nofile\.py')
def test_file_is_generated():
    """User passes good python file. Check notebook file is created"""

    python_to_jupyter_cli(['examples/plot_quantum.py'])
    assert os.path.isfile('examples/plot_quantum.ipynb')
    os.remove('examples/plot_quantum.ipynb')
def test_with_empty_args():
    """ User passes no args, should fail with SystemExit """
    with pytest.raises(SystemExit):
        python_to_jupyter_cli([])
Exemple #5
0
def test_missing_file():
    """ User passes non existing file, should fail with FileNotFoundError """
    with pytest.raises(FileNotFoundError) as excinfo:
        python_to_jupyter_cli(['nofile.py'])
    excinfo.match(r'No such file or directory.+nofile\.py')
Exemple #6
0
def test_with_empty_args():
    """ User passes no args, should fail with SystemExit """
    with pytest.raises(SystemExit):
        python_to_jupyter_cli([])
Exemple #7
0
def test_file_is_generated():
    """User passes good python file. Check notebook file is created"""

    python_to_jupyter_cli(['examples/plot_quantum.py'])
    assert os.path.isfile('examples/plot_quantum.ipynb')
    os.remove('examples/plot_quantum.ipynb')
Exemple #8
0
#!/home/hasitha/PycharmProjects/hec_server/venv/bin/python
# -*- coding: utf-8 -*-
r"""
Sphinx Gallery Notebook converter
=================================

Exposes the Sphinx-Gallery Notebook renderer to directly convert Python
scripts into Jupyter Notebooks.

"""
# Author: Óscar Nájera
# License: 3-clause BSD

from __future__ import division, absolute_import, print_function

from sphinx_gallery.notebook import python_to_jupyter_cli

if __name__ == '__main__':
    python_to_jupyter_cli()