mirror of
https://github.com/aykhans/AzSuicideDataVisualization.git
synced 2025-07-04 15:17:14 +00:00
first commit
This commit is contained in:
39
.venv/Lib/site-packages/nbconvert/exporters/tests/base.py
Normal file
39
.venv/Lib/site-packages/nbconvert/exporters/tests/base.py
Normal file
@ -0,0 +1,39 @@
|
||||
"""Base TestCase class for testing Exporters"""
|
||||
|
||||
# Copyright (c) IPython Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
import os
|
||||
|
||||
from ...tests.base import TestsBase
|
||||
|
||||
all_raw_mimetypes = {
|
||||
"text/x-python",
|
||||
"text/markdown",
|
||||
"text/html",
|
||||
"text/restructuredtext",
|
||||
"text/latex",
|
||||
}
|
||||
|
||||
|
||||
class ExportersTestsBase(TestsBase):
|
||||
"""Contains base test functions for exporters"""
|
||||
|
||||
exporter_class = None
|
||||
should_include_raw = None
|
||||
|
||||
def _get_notebook(self, nb_name="notebook2.ipynb"):
|
||||
return os.path.join(self._get_files_path(), nb_name)
|
||||
|
||||
def test_raw_cell_inclusion(self):
|
||||
"""test raw cell inclusion based on raw_mimetype metadata"""
|
||||
if self.should_include_raw is None:
|
||||
return
|
||||
exporter = self.exporter_class()
|
||||
(output, resources) = exporter.from_filename(self._get_notebook("rawtest.ipynb"))
|
||||
for inc in self.should_include_raw:
|
||||
self.assertIn("raw %s" % inc, output, "should include %s" % inc)
|
||||
self.assertIn("no raw_mimetype metadata", output)
|
||||
for exc in all_raw_mimetypes.difference(self.should_include_raw):
|
||||
self.assertNotIn("raw %s" % exc, output, "should exclude %s" % exc)
|
||||
self.assertNotIn("never be included", output)
|
47
.venv/Lib/site-packages/nbconvert/exporters/tests/cheese.py
Normal file
47
.venv/Lib/site-packages/nbconvert/exporters/tests/cheese.py
Normal file
@ -0,0 +1,47 @@
|
||||
"""
|
||||
Contains CheesePreprocessor
|
||||
"""
|
||||
# -----------------------------------------------------------------------------
|
||||
# Copyright (c) 2013, the IPython Development Team.
|
||||
#
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
#
|
||||
# The full license is in the file COPYING.txt, distributed with this software.
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Imports
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
from ...preprocessors.base import Preprocessor
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Classes
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
class CheesePreprocessor(Preprocessor):
|
||||
"""
|
||||
Adds a cheese tag to the resources object
|
||||
"""
|
||||
|
||||
def __init__(self, **kw):
|
||||
"""
|
||||
Public constructor
|
||||
"""
|
||||
super().__init__(**kw)
|
||||
|
||||
def preprocess(self, nb, resources):
|
||||
"""
|
||||
Sphinx preprocessing to apply on each notebook.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
nb : NotebookNode
|
||||
Notebook being converted
|
||||
resources : dictionary
|
||||
Additional resources used in the conversion process. Allows
|
||||
preprocessors to pass variables into the Jinja engine.
|
||||
"""
|
||||
resources["cheese"] = "real"
|
||||
return nb, resources
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,4 @@
|
||||
{%- extends 'lab/index.html.j2' -%}
|
||||
{%- block body_footer -%}
|
||||
UNIQUE
|
||||
{%- endblock body_footer -%}
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,59 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdin",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"test input: input value\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'input value'"
|
||||
]
|
||||
},
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"input(\"test input:\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"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.8.5"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
@ -0,0 +1,240 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"[<matplotlib.lines.Line2D at 0x10f695240>]"
|
||||
]
|
||||
},
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"image/png": [
|
||||
"iVBORw0KGgoAAAANSUhEUgAAAu0AAAH/CAYAAADjSONqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\n",
|
||||
"AAAWJQAAFiUBSVIk8AAAIABJREFUeJzt3X/M7ndd3/HXezmJG7QpEdqyrbD21OYgLMbNmRK6aM+w\n",
|
||||
"DKMhwDS4RNnmkM0xLIqMyTY5JSEwNy2jiJOxOu1MiEQLW8xoQTBDKttcIJlz/YE9BaFWZdACtoVp\n",
|
||||
"3/vjum56zn3u69w/rl/f73U9HsmVb3t9r/tzf+/e33Puz/3s5/p+q7sDAAAM159Z9wEAAADnZ9IO\n",
|
||||
"AAADZ9IOAAADZ9IOAAADZ9IOAAADZ9IOAAADZ9IOAAADZ9IOAAADZ9IOAAAD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MjkH/lKSs+7dUFXP\n",
|
||||
"S/I3k3w+rjg1Cgv8OfJfp9uXV9VfOHNHVX17JhO0R+KX/I2zzjnnIG+ulCTT/xh3ZPJb7Hvz+K1g\n",
|
||||
"r82kdj1nesmlVNXlmbzx45PdfcVRx2H4FnFeVNXfyeSNQ3+a5KYkX9jjU53u7p9f1tfBYi3q74sZ\n",
|
||||
"Y5+KmyuN0gJ/jvzF6ThPy6S8fzyTH8wvzOTvke/p7luX/gWxEAv6OVKZvJ/h25J8McmtSf4gyddn\n",
|
||||
"snSmk7yqu29axdfEfKrqhZn8eU4md7t9Xibf9517dfxRd79m+trLs64552Fun7rqR5LLMrlt9P2Z\n",
|
||||
"XCP3dCZ3Kbxo1+suz+T2sPfOM47HOB7znheZvNHwsUx+2D424/HBdX+dHqs9L84z7uun58r3r/tr\n",
|
||||
"9FjfeZHJDZbemsk1/L+c5A+T/HKSv7bur9FjPedFJkuMr8/kzqgPZXKFoQeS/Kck37bur9HjUOfD\n",
|
||||
"mfOCMx+P7f7+r3POOdjSDgAATAxyTTsAAPA4k3YAABg4k3YAABg4k3YAABg4k3YAABg4k3YAABg4\n",
|
||||
"k3YAABg4k3YAABg4k3YAABg4k3YAABg4k3YAABg4k3YAABg4k3YAABg4k3YAABg4k3YAABg4k3YA\n",
|
||||
"ABg4k3YAABi4/w/Y3UZ5IHmVbAAAAABJRU5ErkJggg==\n"
|
||||
],
|
||||
"text/plain": [
|
||||
"<matplotlib.figure.Figure at 0x10d0da080>"
|
||||
]
|
||||
},
|
||||
"metadata": {
|
||||
"image/png": {
|
||||
"height": 255,
|
||||
"width": 374
|
||||
}
|
||||
},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"%matplotlib inline\n",
|
||||
"%config InlineBackend.figure_formats = set(['retina'])\n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"plt.plot([0,1],[1,0])"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "IPython mydev (Python 3)",
|
||||
"name": "python3_mydev"
|
||||
},
|
||||
"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.4.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 0
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import numpy as np"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"(100,)"
|
||||
]
|
||||
},
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"evs = np.zeros(100)\n",
|
||||
"evs.shape"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
" "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
" "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 0,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
" "
|
||||
]
|
||||
}
|
||||
],
|
||||
"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.1"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 1
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "raw",
|
||||
"metadata": {
|
||||
"raw_mimetype": "text/html"
|
||||
},
|
||||
"source": [
|
||||
"<b>raw html</b>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "raw",
|
||||
"metadata": {
|
||||
"raw_mimetype": "text/markdown"
|
||||
},
|
||||
"source": [
|
||||
"* raw markdown\n",
|
||||
"* bullet\n",
|
||||
"* list"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "raw",
|
||||
"metadata": {
|
||||
"raw_mimetype": "text/restructuredtext"
|
||||
},
|
||||
"source": [
|
||||
"``raw rst``\n",
|
||||
"\n",
|
||||
".. sourcecode:: python\n",
|
||||
"\n",
|
||||
" def foo(): pass\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "raw",
|
||||
"metadata": {
|
||||
"raw_mimetype": "text/x-python"
|
||||
},
|
||||
"source": [
|
||||
"def bar():\n",
|
||||
" \"\"\"raw python\"\"\"\n",
|
||||
" pass"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "raw",
|
||||
"metadata": {
|
||||
"raw_mimetype": "text/latex"
|
||||
},
|
||||
"source": [
|
||||
"\\LaTeX\n",
|
||||
"% raw latex"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "raw",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# no raw_mimetype metadata, should be included by default"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "raw",
|
||||
"metadata": {
|
||||
"raw_mimetype": "doesnotexist"
|
||||
},
|
||||
"source": [
|
||||
"garbage format defined, should never be included"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 0
|
||||
}
|
@ -0,0 +1,504 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"[<matplotlib.lines.Line2D at 0x7f4c63ec5518>]"
|
||||
]
|
||||
},
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"image/svg+xml": [
|
||||
"<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
|
||||
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
|
||||
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
|
||||
"<!-- Created with matplotlib (http://matplotlib.org/) -->\n",
|
||||
"<svg height=\"252.018125pt\" version=\"1.1\" viewBox=\"0 0 375.603125 252.018125\" width=\"375.603125pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
|
||||
" <defs>\n",
|
||||
" <style type=\"text/css\">\n",
|
||||
"*{stroke-linecap:butt;stroke-linejoin:round;}\n",
|
||||
" </style>\n",
|
||||
" </defs>\n",
|
||||
" <g id=\"figure_1\">\n",
|
||||
" <g id=\"patch_1\">\n",
|
||||
" <path d=\"M 0 252.018125 \n",
|
||||
"L 375.603125 252.018125 \n",
|
||||
"L 375.603125 0 \n",
|
||||
"L 0 0 \n",
|
||||
"z\n",
|
||||
"\" style=\"fill:none;\"/>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"axes_1\">\n",
|
||||
" <g id=\"patch_2\">\n",
|
||||
" <path d=\"M 30.103125 228.14 \n",
|
||||
"L 364.903125 228.14 \n",
|
||||
"L 364.903125 10.7 \n",
|
||||
"L 30.103125 10.7 \n",
|
||||
"z\n",
|
||||
"\" style=\"fill:#ffffff;\"/>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"matplotlib.axis_1\">\n",
|
||||
" <g id=\"xtick_1\">\n",
|
||||
" <g id=\"line2d_1\">\n",
|
||||
" <defs>\n",
|
||||
" <path d=\"M 0 0 \n",
|
||||
"L 0 3.5 \n",
|
||||
"\" id=\"mbaa5d3ac27\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
|
||||
" </defs>\n",
|
||||
" <g>\n",
|
||||
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"45.321307\" xlink:href=\"#mbaa5d3ac27\" y=\"228.14\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"text_1\">\n",
|
||||
" <!-- 0 -->\n",
|
||||
" <defs>\n",
|
||||
" <path d=\"M 31.78125 66.40625 \n",
|
||||
"Q 24.171875 66.40625 20.328125 58.90625 \n",
|
||||
"Q 16.5 51.421875 16.5 36.375 \n",
|
||||
"Q 16.5 21.390625 20.328125 13.890625 \n",
|
||||
"Q 24.171875 6.390625 31.78125 6.390625 \n",
|
||||
"Q 39.453125 6.390625 43.28125 13.890625 \n",
|
||||
"Q 47.125 21.390625 47.125 36.375 \n",
|
||||
"Q 47.125 51.421875 43.28125 58.90625 \n",
|
||||
"Q 39.453125 66.40625 31.78125 66.40625 \n",
|
||||
"z\n",
|
||||
"M 31.78125 74.21875 \n",
|
||||
"Q 44.046875 74.21875 50.515625 64.515625 \n",
|
||||
"Q 56.984375 54.828125 56.984375 36.375 \n",
|
||||
"Q 56.984375 17.96875 50.515625 8.265625 \n",
|
||||
"Q 44.046875 -1.421875 31.78125 -1.421875 \n",
|
||||
"Q 19.53125 -1.421875 13.0625 8.265625 \n",
|
||||
"Q 6.59375 17.96875 6.59375 36.375 \n",
|
||||
"Q 6.59375 54.828125 13.0625 64.515625 \n",
|
||||
"Q 19.53125 74.21875 31.78125 74.21875 \n",
|
||||
"z\n",
|
||||
"\" id=\"DejaVuSans-30\"/>\n",
|
||||
" </defs>\n",
|
||||
" <g transform=\"translate(42.140057 242.738437)scale(0.1 -0.1)\">\n",
|
||||
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"xtick_2\">\n",
|
||||
" <g id=\"line2d_2\">\n",
|
||||
" <g>\n",
|
||||
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"106.194034\" xlink:href=\"#mbaa5d3ac27\" y=\"228.14\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"text_2\">\n",
|
||||
" <!-- 1 -->\n",
|
||||
" <defs>\n",
|
||||
" <path d=\"M 12.40625 8.296875 \n",
|
||||
"L 28.515625 8.296875 \n",
|
||||
"L 28.515625 63.921875 \n",
|
||||
"L 10.984375 60.40625 \n",
|
||||
"L 10.984375 69.390625 \n",
|
||||
"L 28.421875 72.90625 \n",
|
||||
"L 38.28125 72.90625 \n",
|
||||
"L 38.28125 8.296875 \n",
|
||||
"L 54.390625 8.296875 \n",
|
||||
"L 54.390625 0 \n",
|
||||
"L 12.40625 0 \n",
|
||||
"z\n",
|
||||
"\" id=\"DejaVuSans-31\"/>\n",
|
||||
" </defs>\n",
|
||||
" <g transform=\"translate(103.012784 242.738437)scale(0.1 -0.1)\">\n",
|
||||
" <use xlink:href=\"#DejaVuSans-31\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"xtick_3\">\n",
|
||||
" <g id=\"line2d_3\">\n",
|
||||
" <g>\n",
|
||||
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"167.066761\" xlink:href=\"#mbaa5d3ac27\" y=\"228.14\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"text_3\">\n",
|
||||
" <!-- 2 -->\n",
|
||||
" <defs>\n",
|
||||
" <path d=\"M 19.1875 8.296875 \n",
|
||||
"L 53.609375 8.296875 \n",
|
||||
"L 53.609375 0 \n",
|
||||
"L 7.328125 0 \n",
|
||||
"L 7.328125 8.296875 \n",
|
||||
"Q 12.9375 14.109375 22.625 23.890625 \n",
|
||||
"Q 32.328125 33.6875 34.8125 36.53125 \n",
|
||||
"Q 39.546875 41.84375 41.421875 45.53125 \n",
|
||||
"Q 43.3125 49.21875 43.3125 52.78125 \n",
|
||||
"Q 43.3125 58.59375 39.234375 62.25 \n",
|
||||
"Q 35.15625 65.921875 28.609375 65.921875 \n",
|
||||
"Q 23.96875 65.921875 18.8125 64.3125 \n",
|
||||
"Q 13.671875 62.703125 7.8125 59.421875 \n",
|
||||
"L 7.8125 69.390625 \n",
|
||||
"Q 13.765625 71.78125 18.9375 73 \n",
|
||||
"Q 24.125 74.21875 28.421875 74.21875 \n",
|
||||
"Q 39.75 74.21875 46.484375 68.546875 \n",
|
||||
"Q 53.21875 62.890625 53.21875 53.421875 \n",
|
||||
"Q 53.21875 48.921875 51.53125 44.890625 \n",
|
||||
"Q 49.859375 40.875 45.40625 35.40625 \n",
|
||||
"Q 44.1875 33.984375 37.640625 27.21875 \n",
|
||||
"Q 31.109375 20.453125 19.1875 8.296875 \n",
|
||||
"z\n",
|
||||
"\" id=\"DejaVuSans-32\"/>\n",
|
||||
" </defs>\n",
|
||||
" <g transform=\"translate(163.885511 242.738437)scale(0.1 -0.1)\">\n",
|
||||
" <use xlink:href=\"#DejaVuSans-32\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"xtick_4\">\n",
|
||||
" <g id=\"line2d_4\">\n",
|
||||
" <g>\n",
|
||||
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"227.939489\" xlink:href=\"#mbaa5d3ac27\" y=\"228.14\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"text_4\">\n",
|
||||
" <!-- 3 -->\n",
|
||||
" <defs>\n",
|
||||
" <path d=\"M 40.578125 39.3125 \n",
|
||||
"Q 47.65625 37.796875 51.625 33 \n",
|
||||
"Q 55.609375 28.21875 55.609375 21.1875 \n",
|
||||
"Q 55.609375 10.40625 48.1875 4.484375 \n",
|
||||
"Q 40.765625 -1.421875 27.09375 -1.421875 \n",
|
||||
"Q 22.515625 -1.421875 17.65625 -0.515625 \n",
|
||||
"Q 12.796875 0.390625 7.625 2.203125 \n",
|
||||
"L 7.625 11.71875 \n",
|
||||
"Q 11.71875 9.328125 16.59375 8.109375 \n",
|
||||
"Q 21.484375 6.890625 26.8125 6.890625 \n",
|
||||
"Q 36.078125 6.890625 40.9375 10.546875 \n",
|
||||
"Q 45.796875 14.203125 45.796875 21.1875 \n",
|
||||
"Q 45.796875 27.640625 41.28125 31.265625 \n",
|
||||
"Q 36.765625 34.90625 28.71875 34.90625 \n",
|
||||
"L 20.21875 34.90625 \n",
|
||||
"L 20.21875 43.015625 \n",
|
||||
"L 29.109375 43.015625 \n",
|
||||
"Q 36.375 43.015625 40.234375 45.921875 \n",
|
||||
"Q 44.09375 48.828125 44.09375 54.296875 \n",
|
||||
"Q 44.09375 59.90625 40.109375 62.90625 \n",
|
||||
"Q 36.140625 65.921875 28.71875 65.921875 \n",
|
||||
"Q 24.65625 65.921875 20.015625 65.03125 \n",
|
||||
"Q 15.375 64.15625 9.8125 62.3125 \n",
|
||||
"L 9.8125 71.09375 \n",
|
||||
"Q 15.4375 72.65625 20.34375 73.4375 \n",
|
||||
"Q 25.25 74.21875 29.59375 74.21875 \n",
|
||||
"Q 40.828125 74.21875 47.359375 69.109375 \n",
|
||||
"Q 53.90625 64.015625 53.90625 55.328125 \n",
|
||||
"Q 53.90625 49.265625 50.4375 45.09375 \n",
|
||||
"Q 46.96875 40.921875 40.578125 39.3125 \n",
|
||||
"z\n",
|
||||
"\" id=\"DejaVuSans-33\"/>\n",
|
||||
" </defs>\n",
|
||||
" <g transform=\"translate(224.758239 242.738437)scale(0.1 -0.1)\">\n",
|
||||
" <use xlink:href=\"#DejaVuSans-33\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"xtick_5\">\n",
|
||||
" <g id=\"line2d_5\">\n",
|
||||
" <g>\n",
|
||||
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"288.812216\" xlink:href=\"#mbaa5d3ac27\" y=\"228.14\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"text_5\">\n",
|
||||
" <!-- 4 -->\n",
|
||||
" <defs>\n",
|
||||
" <path d=\"M 37.796875 64.3125 \n",
|
||||
"L 12.890625 25.390625 \n",
|
||||
"L 37.796875 25.390625 \n",
|
||||
"z\n",
|
||||
"M 35.203125 72.90625 \n",
|
||||
"L 47.609375 72.90625 \n",
|
||||
"L 47.609375 25.390625 \n",
|
||||
"L 58.015625 25.390625 \n",
|
||||
"L 58.015625 17.1875 \n",
|
||||
"L 47.609375 17.1875 \n",
|
||||
"L 47.609375 0 \n",
|
||||
"L 37.796875 0 \n",
|
||||
"L 37.796875 17.1875 \n",
|
||||
"L 4.890625 17.1875 \n",
|
||||
"L 4.890625 26.703125 \n",
|
||||
"z\n",
|
||||
"\" id=\"DejaVuSans-34\"/>\n",
|
||||
" </defs>\n",
|
||||
" <g transform=\"translate(285.630966 242.738437)scale(0.1 -0.1)\">\n",
|
||||
" <use xlink:href=\"#DejaVuSans-34\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"xtick_6\">\n",
|
||||
" <g id=\"line2d_6\">\n",
|
||||
" <g>\n",
|
||||
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"349.684943\" xlink:href=\"#mbaa5d3ac27\" y=\"228.14\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"text_6\">\n",
|
||||
" <!-- 5 -->\n",
|
||||
" <defs>\n",
|
||||
" <path d=\"M 10.796875 72.90625 \n",
|
||||
"L 49.515625 72.90625 \n",
|
||||
"L 49.515625 64.59375 \n",
|
||||
"L 19.828125 64.59375 \n",
|
||||
"L 19.828125 46.734375 \n",
|
||||
"Q 21.96875 47.46875 24.109375 47.828125 \n",
|
||||
"Q 26.265625 48.1875 28.421875 48.1875 \n",
|
||||
"Q 40.625 48.1875 47.75 41.5 \n",
|
||||
"Q 54.890625 34.8125 54.890625 23.390625 \n",
|
||||
"Q 54.890625 11.625 47.5625 5.09375 \n",
|
||||
"Q 40.234375 -1.421875 26.90625 -1.421875 \n",
|
||||
"Q 22.3125 -1.421875 17.546875 -0.640625 \n",
|
||||
"Q 12.796875 0.140625 7.71875 1.703125 \n",
|
||||
"L 7.71875 11.625 \n",
|
||||
"Q 12.109375 9.234375 16.796875 8.0625 \n",
|
||||
"Q 21.484375 6.890625 26.703125 6.890625 \n",
|
||||
"Q 35.15625 6.890625 40.078125 11.328125 \n",
|
||||
"Q 45.015625 15.765625 45.015625 23.390625 \n",
|
||||
"Q 45.015625 31 40.078125 35.4375 \n",
|
||||
"Q 35.15625 39.890625 26.703125 39.890625 \n",
|
||||
"Q 22.75 39.890625 18.8125 39.015625 \n",
|
||||
"Q 14.890625 38.140625 10.796875 36.28125 \n",
|
||||
"z\n",
|
||||
"\" id=\"DejaVuSans-35\"/>\n",
|
||||
" </defs>\n",
|
||||
" <g transform=\"translate(346.503693 242.738437)scale(0.1 -0.1)\">\n",
|
||||
" <use xlink:href=\"#DejaVuSans-35\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"matplotlib.axis_2\">\n",
|
||||
" <g id=\"ytick_1\">\n",
|
||||
" <g id=\"line2d_7\">\n",
|
||||
" <defs>\n",
|
||||
" <path d=\"M 0 0 \n",
|
||||
"L -3.5 0 \n",
|
||||
"\" id=\"m7fb83757f4\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
|
||||
" </defs>\n",
|
||||
" <g>\n",
|
||||
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"30.103125\" xlink:href=\"#m7fb83757f4\" y=\"218.256364\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"text_7\">\n",
|
||||
" <!-- 0.0 -->\n",
|
||||
" <defs>\n",
|
||||
" <path d=\"M 10.6875 12.40625 \n",
|
||||
"L 21 12.40625 \n",
|
||||
"L 21 0 \n",
|
||||
"L 10.6875 0 \n",
|
||||
"z\n",
|
||||
"\" id=\"DejaVuSans-2e\"/>\n",
|
||||
" </defs>\n",
|
||||
" <g transform=\"translate(7.2 222.055582)scale(0.1 -0.1)\">\n",
|
||||
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
|
||||
" <use x=\"63.623047\" xlink:href=\"#DejaVuSans-2e\"/>\n",
|
||||
" <use x=\"95.410156\" xlink:href=\"#DejaVuSans-30\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"ytick_2\">\n",
|
||||
" <g id=\"line2d_8\">\n",
|
||||
" <g>\n",
|
||||
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"30.103125\" xlink:href=\"#m7fb83757f4\" y=\"193.547273\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"text_8\">\n",
|
||||
" <!-- 0.5 -->\n",
|
||||
" <g transform=\"translate(7.2 197.346491)scale(0.1 -0.1)\">\n",
|
||||
" <use xlink:href=\"#DejaVuSans-30\"/>\n",
|
||||
" <use x=\"63.623047\" xlink:href=\"#DejaVuSans-2e\"/>\n",
|
||||
" <use x=\"95.410156\" xlink:href=\"#DejaVuSans-35\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"ytick_3\">\n",
|
||||
" <g id=\"line2d_9\">\n",
|
||||
" <g>\n",
|
||||
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"30.103125\" xlink:href=\"#m7fb83757f4\" y=\"168.838182\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"text_9\">\n",
|
||||
" <!-- 1.0 -->\n",
|
||||
" <g transform=\"translate(7.2 172.637401)scale(0.1 -0.1)\">\n",
|
||||
" <use xlink:href=\"#DejaVuSans-31\"/>\n",
|
||||
" <use x=\"63.623047\" xlink:href=\"#DejaVuSans-2e\"/>\n",
|
||||
" <use x=\"95.410156\" xlink:href=\"#DejaVuSans-30\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"ytick_4\">\n",
|
||||
" <g id=\"line2d_10\">\n",
|
||||
" <g>\n",
|
||||
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"30.103125\" xlink:href=\"#m7fb83757f4\" y=\"144.129091\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"text_10\">\n",
|
||||
" <!-- 1.5 -->\n",
|
||||
" <g transform=\"translate(7.2 147.92831)scale(0.1 -0.1)\">\n",
|
||||
" <use xlink:href=\"#DejaVuSans-31\"/>\n",
|
||||
" <use x=\"63.623047\" xlink:href=\"#DejaVuSans-2e\"/>\n",
|
||||
" <use x=\"95.410156\" xlink:href=\"#DejaVuSans-35\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"ytick_5\">\n",
|
||||
" <g id=\"line2d_11\">\n",
|
||||
" <g>\n",
|
||||
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"30.103125\" xlink:href=\"#m7fb83757f4\" y=\"119.42\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"text_11\">\n",
|
||||
" <!-- 2.0 -->\n",
|
||||
" <g transform=\"translate(7.2 123.219219)scale(0.1 -0.1)\">\n",
|
||||
" <use xlink:href=\"#DejaVuSans-32\"/>\n",
|
||||
" <use x=\"63.623047\" xlink:href=\"#DejaVuSans-2e\"/>\n",
|
||||
" <use x=\"95.410156\" xlink:href=\"#DejaVuSans-30\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"ytick_6\">\n",
|
||||
" <g id=\"line2d_12\">\n",
|
||||
" <g>\n",
|
||||
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"30.103125\" xlink:href=\"#m7fb83757f4\" y=\"94.710909\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"text_12\">\n",
|
||||
" <!-- 2.5 -->\n",
|
||||
" <g transform=\"translate(7.2 98.510128)scale(0.1 -0.1)\">\n",
|
||||
" <use xlink:href=\"#DejaVuSans-32\"/>\n",
|
||||
" <use x=\"63.623047\" xlink:href=\"#DejaVuSans-2e\"/>\n",
|
||||
" <use x=\"95.410156\" xlink:href=\"#DejaVuSans-35\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"ytick_7\">\n",
|
||||
" <g id=\"line2d_13\">\n",
|
||||
" <g>\n",
|
||||
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"30.103125\" xlink:href=\"#m7fb83757f4\" y=\"70.001818\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"text_13\">\n",
|
||||
" <!-- 3.0 -->\n",
|
||||
" <g transform=\"translate(7.2 73.801037)scale(0.1 -0.1)\">\n",
|
||||
" <use xlink:href=\"#DejaVuSans-33\"/>\n",
|
||||
" <use x=\"63.623047\" xlink:href=\"#DejaVuSans-2e\"/>\n",
|
||||
" <use x=\"95.410156\" xlink:href=\"#DejaVuSans-30\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"ytick_8\">\n",
|
||||
" <g id=\"line2d_14\">\n",
|
||||
" <g>\n",
|
||||
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"30.103125\" xlink:href=\"#m7fb83757f4\" y=\"45.292727\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"text_14\">\n",
|
||||
" <!-- 3.5 -->\n",
|
||||
" <g transform=\"translate(7.2 49.091946)scale(0.1 -0.1)\">\n",
|
||||
" <use xlink:href=\"#DejaVuSans-33\"/>\n",
|
||||
" <use x=\"63.623047\" xlink:href=\"#DejaVuSans-2e\"/>\n",
|
||||
" <use x=\"95.410156\" xlink:href=\"#DejaVuSans-35\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"ytick_9\">\n",
|
||||
" <g id=\"line2d_15\">\n",
|
||||
" <g>\n",
|
||||
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"30.103125\" xlink:href=\"#m7fb83757f4\" y=\"20.583636\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"text_15\">\n",
|
||||
" <!-- 4.0 -->\n",
|
||||
" <g transform=\"translate(7.2 24.382855)scale(0.1 -0.1)\">\n",
|
||||
" <use xlink:href=\"#DejaVuSans-34\"/>\n",
|
||||
" <use x=\"63.623047\" xlink:href=\"#DejaVuSans-2e\"/>\n",
|
||||
" <use x=\"95.410156\" xlink:href=\"#DejaVuSans-30\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"line2d_16\">\n",
|
||||
" <path clip-path=\"url(#pf878579141)\" d=\"M 45.321307 218.256364 \n",
|
||||
"L 106.194034 70.001818 \n",
|
||||
"L 167.066761 20.583636 \n",
|
||||
"L 227.939489 20.583636 \n",
|
||||
"L 288.812216 70.001818 \n",
|
||||
"L 349.684943 218.256364 \n",
|
||||
"\" style=\"fill:none;stroke:#1f77b4;stroke-linecap:square;stroke-width:1.5;\"/>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"patch_3\">\n",
|
||||
" <path d=\"M 30.103125 228.14 \n",
|
||||
"L 30.103125 10.7 \n",
|
||||
"\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"patch_4\">\n",
|
||||
" <path d=\"M 364.903125 228.14 \n",
|
||||
"L 364.903125 10.7 \n",
|
||||
"\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"patch_5\">\n",
|
||||
" <path d=\"M 30.103125 228.14 \n",
|
||||
"L 364.903125 228.14 \n",
|
||||
"\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
|
||||
" </g>\n",
|
||||
" <g id=\"patch_6\">\n",
|
||||
" <path d=\"M 30.103125 10.7 \n",
|
||||
"L 364.903125 10.7 \n",
|
||||
"\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" </g>\n",
|
||||
" <defs>\n",
|
||||
" <clipPath id=\"pf878579141\">\n",
|
||||
" <rect height=\"217.44\" width=\"334.8\" x=\"30.103125\" y=\"10.7\"/>\n",
|
||||
" </clipPath>\n",
|
||||
" </defs>\n",
|
||||
"</svg>\n"
|
||||
],
|
||||
"text/plain": [
|
||||
"<Figure size 432x288 with 1 Axes>"
|
||||
]
|
||||
},
|
||||
"metadata": {
|
||||
"needs_background": "light"
|
||||
},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"%matplotlib inline\n",
|
||||
"%config InlineBackend.figure_formats = ['svg'] \n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"plt.plot((0,1,2,3,4,5),(0,3,4,4,3,0))"
|
||||
]
|
||||
}
|
||||
],
|
||||
"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.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
"""Tests for ASCIIDocExporter`"""
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Copyright (c) 2016, the IPython Development Team.
|
||||
#
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
#
|
||||
# The full license is in the file COPYING.txt, distributed with this software.
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Imports
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
import re
|
||||
|
||||
from traitlets.config import Config
|
||||
|
||||
from ...tests.utils import onlyif_cmds_exist
|
||||
from ..asciidoc import ASCIIDocExporter
|
||||
from .base import ExportersTestsBase
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Class
|
||||
# -----------------------------------------------------------------------------
|
||||
in_regex = r"In\[(.*)\]:"
|
||||
out_regex = r"Out\[(.*)\]:"
|
||||
|
||||
|
||||
class TestASCIIDocExporter(ExportersTestsBase):
|
||||
"""Tests for ASCIIDocExporter"""
|
||||
|
||||
exporter_class = ASCIIDocExporter
|
||||
|
||||
def test_constructor(self):
|
||||
"""
|
||||
Can a ASCIIDocExporter be constructed?
|
||||
"""
|
||||
ASCIIDocExporter()
|
||||
|
||||
@onlyif_cmds_exist("pandoc")
|
||||
def test_export(self):
|
||||
"""
|
||||
Can a ASCIIDocExporter export something?
|
||||
"""
|
||||
(output, resources) = ASCIIDocExporter().from_filename(self._get_notebook())
|
||||
assert len(output) > 0
|
||||
|
||||
assert re.findall(in_regex, output)
|
||||
assert re.findall(out_regex, output)
|
||||
|
||||
@onlyif_cmds_exist("pandoc")
|
||||
def test_export_no_prompt(self):
|
||||
"""
|
||||
Can a ASCIIDocExporter export something without prompts?
|
||||
"""
|
||||
no_prompt = {
|
||||
"TemplateExporter": {
|
||||
"exclude_input_prompt": True,
|
||||
"exclude_output_prompt": True,
|
||||
}
|
||||
}
|
||||
c_no_prompt = Config(no_prompt)
|
||||
exporter = ASCIIDocExporter(config=c_no_prompt)
|
||||
(output, resources) = exporter.from_filename(
|
||||
self._get_notebook(nb_name="prompt_numbers.ipynb")
|
||||
)
|
||||
|
||||
assert not re.findall(in_regex, output)
|
||||
assert not re.findall(out_regex, output)
|
116
.venv/Lib/site-packages/nbconvert/exporters/tests/test_export.py
Normal file
116
.venv/Lib/site-packages/nbconvert/exporters/tests/test_export.py
Normal file
@ -0,0 +1,116 @@
|
||||
"""
|
||||
Module with tests for export.py
|
||||
"""
|
||||
|
||||
# Copyright (c) IPython Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
import nbformat
|
||||
import pytest
|
||||
from traitlets.config import Config
|
||||
|
||||
import nbconvert.tests
|
||||
|
||||
from ..base import (
|
||||
ExporterDisabledError,
|
||||
ExporterNameError,
|
||||
export,
|
||||
get_export_names,
|
||||
get_exporter,
|
||||
)
|
||||
from ..exporter import Exporter
|
||||
from ..python import PythonExporter
|
||||
from .base import ExportersTestsBase
|
||||
|
||||
|
||||
class TestExport(ExportersTestsBase):
|
||||
"""Contains test functions for export.py"""
|
||||
|
||||
def test_export_wrong_name(self):
|
||||
"""
|
||||
Is the right error thrown when a bad template name is used?
|
||||
"""
|
||||
try:
|
||||
exporter = get_exporter("not_a_name")
|
||||
export(exporter, self._get_notebook())
|
||||
except ExporterNameError as e:
|
||||
pass
|
||||
|
||||
def test_export_disabled(self):
|
||||
"""
|
||||
Trying to use a disabled exporter should raise ExporterDisbledError
|
||||
"""
|
||||
config = Config({"NotebookExporter": {"enabled": False}})
|
||||
with pytest.raises(ExporterDisabledError):
|
||||
get_exporter("notebook", config=config)
|
||||
|
||||
def test_export_filename(self):
|
||||
"""
|
||||
Can a notebook be exported by filename?
|
||||
"""
|
||||
exporter = get_exporter("python")
|
||||
(output, resources) = export(exporter, self._get_notebook())
|
||||
assert len(output) > 0
|
||||
|
||||
def test_export_nbnode(self):
|
||||
"""
|
||||
Can a notebook be exported by a notebook node handle?
|
||||
"""
|
||||
with open(self._get_notebook()) as f:
|
||||
notebook = nbformat.read(f, 4)
|
||||
exporter = get_exporter("python")
|
||||
(output, resources) = export(exporter, notebook)
|
||||
assert len(output) > 0
|
||||
|
||||
def test_export_filestream(self):
|
||||
"""
|
||||
Can a notebook be exported by a filesteam?
|
||||
"""
|
||||
with open(self._get_notebook()) as f:
|
||||
exporter = get_exporter("python")
|
||||
(output, resources) = export(exporter, f)
|
||||
assert len(output) > 0
|
||||
|
||||
def test_export_using_exporter(self):
|
||||
"""
|
||||
Can a notebook be exported using an instanciated exporter?
|
||||
"""
|
||||
(output, resources) = export(PythonExporter(), self._get_notebook())
|
||||
assert len(output) > 0
|
||||
|
||||
def test_export_using_exporter_class(self):
|
||||
"""
|
||||
Can a notebook be exported using an exporter class type?
|
||||
"""
|
||||
(output, resources) = export(PythonExporter, self._get_notebook())
|
||||
assert len(output) > 0
|
||||
|
||||
def test_export_resources(self):
|
||||
"""
|
||||
Can a notebook be exported along with a custom resources dict?
|
||||
"""
|
||||
(output, resources) = export(PythonExporter, self._get_notebook(), resources={})
|
||||
assert len(output) > 0
|
||||
|
||||
def test_no_exporter(self):
|
||||
"""
|
||||
Is the right error thrown if no exporter is provided?
|
||||
"""
|
||||
try:
|
||||
(output, resources) = export(None, self._get_notebook())
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
|
||||
def test_get_exporter_entrypoint():
|
||||
p = os.path.join(os.path.dirname(nbconvert.tests.__file__), "exporter_entrypoint")
|
||||
sys.path.insert(0, p)
|
||||
assert "entrypoint_test" in get_export_names()
|
||||
try:
|
||||
cls = get_exporter("entrypoint_test")
|
||||
assert issubclass(cls, Exporter), cls
|
||||
finally:
|
||||
del sys.path[0]
|
@ -0,0 +1,89 @@
|
||||
"""
|
||||
Module with tests for exporter.py
|
||||
"""
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Copyright (c) 2013, the IPython Development Team.
|
||||
#
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
#
|
||||
# The full license is in the file COPYING.txt, distributed with this software.
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Imports
|
||||
# -----------------------------------------------------------------------------
|
||||
import os
|
||||
from unittest.mock import patch
|
||||
|
||||
from traitlets.config import Config
|
||||
|
||||
from ...preprocessors.base import Preprocessor
|
||||
from ..base import get_export_names
|
||||
from ..exporter import Exporter
|
||||
from .base import ExportersTestsBase
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Class
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
class PizzaPreprocessor(Preprocessor):
|
||||
"""Simple preprocessor that adds a 'pizza' entry to the NotebookNode. Used
|
||||
to test Exporter.
|
||||
"""
|
||||
|
||||
def preprocess(self, nb, resources):
|
||||
nb["pizza"] = "cheese"
|
||||
return nb, resources
|
||||
|
||||
|
||||
class TestExporter(ExportersTestsBase):
|
||||
"""Contains test functions for exporter.py"""
|
||||
|
||||
def test_constructor(self):
|
||||
"""Can an Exporter be constructed?"""
|
||||
Exporter()
|
||||
|
||||
def test_export(self):
|
||||
"""Can an Exporter export something?"""
|
||||
exporter = Exporter()
|
||||
(notebook, resources) = exporter.from_filename(self._get_notebook())
|
||||
assert isinstance(notebook, dict)
|
||||
|
||||
def test_preprocessor(self):
|
||||
"""Do preprocessors work?"""
|
||||
config = Config({"Exporter": {"preprocessors": [PizzaPreprocessor()]}})
|
||||
exporter = Exporter(config=config)
|
||||
(notebook, resources) = exporter.from_filename(self._get_notebook())
|
||||
self.assertEqual(notebook["pizza"], "cheese")
|
||||
|
||||
def test_get_export_names_disable(self):
|
||||
"""Can we disable all exporters then enable a single one"""
|
||||
config = Config({"Exporter": {"enabled": False}, "NotebookExporter": {"enabled": True}})
|
||||
export_names = get_export_names(config=config)
|
||||
self.assertEqual(export_names, ["notebook"])
|
||||
|
||||
def test_get_exporter_disable_config_exporters(self):
|
||||
"""
|
||||
Does get_export_names behave correctly with respect to
|
||||
NBCONVERT_DISABLE_CONFIG_EXPORTERS being set in the
|
||||
environment?
|
||||
"""
|
||||
config = Config({"Exporter": {"enabled": False}, "NotebookExporter": {"enabled": True}})
|
||||
os.environ["NBCONVERT_DISABLE_CONFIG_EXPORTERS"] = "1"
|
||||
with patch("nbconvert.exporters.base.get_exporter") as exp:
|
||||
export_names = get_export_names(config=config)
|
||||
# get_export_names should not call get_exporter for
|
||||
# any of the entry points because we return before then.
|
||||
exp.assert_not_called()
|
||||
|
||||
# We should have all exporters, not just the ones
|
||||
# enabled in the config
|
||||
self.assertNotEqual(export_names, ["notebook"])
|
||||
|
||||
# In the absence of this variable we should revert to
|
||||
# the normal behavior.
|
||||
del os.environ["NBCONVERT_DISABLE_CONFIG_EXPORTERS"]
|
||||
export_names = get_export_names(config=config)
|
||||
self.assertEqual(export_names, ["notebook"])
|
136
.venv/Lib/site-packages/nbconvert/exporters/tests/test_html.py
Normal file
136
.venv/Lib/site-packages/nbconvert/exporters/tests/test_html.py
Normal file
@ -0,0 +1,136 @@
|
||||
"""Tests for HTMLExporter"""
|
||||
|
||||
# Copyright (c) IPython Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
import re
|
||||
|
||||
from nbformat import v4
|
||||
from traitlets.config import Config
|
||||
|
||||
from ..html import HTMLExporter
|
||||
from .base import ExportersTestsBase
|
||||
|
||||
|
||||
class TestHTMLExporter(ExportersTestsBase):
|
||||
"""Tests for HTMLExporter"""
|
||||
|
||||
exporter_class = HTMLExporter
|
||||
should_include_raw = ["html"]
|
||||
|
||||
def test_constructor(self):
|
||||
"""
|
||||
Can a HTMLExporter be constructed?
|
||||
"""
|
||||
HTMLExporter()
|
||||
|
||||
def test_export(self):
|
||||
"""
|
||||
Can a HTMLExporter export something?
|
||||
"""
|
||||
(output, resources) = HTMLExporter().from_filename(self._get_notebook())
|
||||
assert len(output) > 0
|
||||
|
||||
def test_export_classic(self):
|
||||
"""
|
||||
Can a HTMLExporter export using the 'classic' template?
|
||||
"""
|
||||
(output, resources) = HTMLExporter(template_name="classic").from_filename(
|
||||
self._get_notebook()
|
||||
)
|
||||
assert len(output) > 0
|
||||
|
||||
def test_export_notebook(self):
|
||||
"""
|
||||
Can a HTMLExporter export using the 'lab' template?
|
||||
"""
|
||||
(output, resources) = HTMLExporter(template_name="lab").from_filename(self._get_notebook())
|
||||
assert len(output) > 0
|
||||
|
||||
def test_prompt_number(self):
|
||||
"""
|
||||
Does HTMLExporter properly format input and output prompts?
|
||||
"""
|
||||
no_prompt_conf = Config(
|
||||
{
|
||||
"TemplateExporter": {
|
||||
"exclude_input_prompt": True,
|
||||
"exclude_output_prompt": True,
|
||||
}
|
||||
}
|
||||
)
|
||||
exporter = HTMLExporter(config=no_prompt_conf, template_name="lab")
|
||||
(output, resources) = exporter.from_filename(
|
||||
self._get_notebook(nb_name="prompt_numbers.ipynb")
|
||||
)
|
||||
in_regex = r"In \[(.*)\]:"
|
||||
out_regex = r"Out\[(.*)\]:"
|
||||
|
||||
assert not re.findall(in_regex, output)
|
||||
assert not re.findall(out_regex, output)
|
||||
|
||||
def test_png_metadata(self):
|
||||
"""
|
||||
Does HTMLExporter with the 'classic' template treat pngs with width/height metadata correctly?
|
||||
"""
|
||||
(output, resources) = HTMLExporter(template_name="classic").from_filename(
|
||||
self._get_notebook(nb_name="pngmetadata.ipynb")
|
||||
)
|
||||
check_for_png = re.compile(r'<img src="[^"]*?"([^>]*?)>')
|
||||
result = check_for_png.search(output)
|
||||
attr_string = result.group(1)
|
||||
assert "width" in attr_string
|
||||
assert "height" in attr_string
|
||||
|
||||
def test_javascript_output(self):
|
||||
nb = v4.new_notebook(
|
||||
cells=[
|
||||
v4.new_code_cell(
|
||||
outputs=[
|
||||
v4.new_output(
|
||||
output_type="display_data",
|
||||
data={"application/javascript": "javascript_output();"},
|
||||
)
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
(output, resources) = HTMLExporter(template_name="classic").from_notebook_node(nb)
|
||||
self.assertIn("javascript_output", output)
|
||||
|
||||
def test_attachments(self):
|
||||
(output, resources) = HTMLExporter(template_name="classic").from_file(
|
||||
self._get_notebook(nb_name="attachment.ipynb")
|
||||
)
|
||||
check_for_png = re.compile(r'<img src="[^"]*?"([^>]*?)>')
|
||||
result = check_for_png.search(output)
|
||||
self.assertTrue(result.group(0).strip().startswith('<img src="data:image/png;base64,iVBOR'))
|
||||
self.assertTrue(result.group(1).strip().startswith('alt="image.png"'))
|
||||
|
||||
check_for_data = re.compile(r'<img src="(?P<url>[^"]*?)"')
|
||||
results = check_for_data.findall(output)
|
||||
assert results[0] != results[1], "attachments only need to be unique within a cell"
|
||||
assert "image/svg" in results[1], "second image should use svg"
|
||||
|
||||
def test_custom_filter_highlight_code(self):
|
||||
# Overwriting filters takes place at: Exporter.from_notebook_node
|
||||
nb = v4.new_notebook()
|
||||
nb.cells.append(v4.new_code_cell("some_text"))
|
||||
|
||||
def custom_highlight_code(source, language="python", metadata=None):
|
||||
return source + " ADDED_TEXT"
|
||||
|
||||
filters = {"highlight_code": custom_highlight_code}
|
||||
(output, resources) = HTMLExporter(
|
||||
template_name="classic", filters=filters
|
||||
).from_notebook_node(nb)
|
||||
self.assertTrue("ADDED_TEXT" in output)
|
||||
|
||||
def test_basic_name(self):
|
||||
"""
|
||||
Can a HTMLExporter export using the 'basic' template?
|
||||
"""
|
||||
(output, resources) = HTMLExporter(template_name="basic").from_filename(
|
||||
self._get_notebook()
|
||||
)
|
||||
assert len(output) > 0
|
189
.venv/Lib/site-packages/nbconvert/exporters/tests/test_latex.py
Normal file
189
.venv/Lib/site-packages/nbconvert/exporters/tests/test_latex.py
Normal file
@ -0,0 +1,189 @@
|
||||
"""Tests for Latex exporter"""
|
||||
|
||||
# Copyright (c) IPython Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
import os.path
|
||||
import re
|
||||
import textwrap
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from jinja2 import DictLoader
|
||||
from nbformat import v4, write
|
||||
from traitlets.config import Config
|
||||
|
||||
from ...tests.utils import onlyif_cmds_exist
|
||||
from ..latex import LatexExporter
|
||||
from .base import ExportersTestsBase
|
||||
|
||||
current_dir = os.path.dirname(__file__)
|
||||
|
||||
|
||||
class TestLatexExporter(ExportersTestsBase):
|
||||
"""Contains test functions for latex.py"""
|
||||
|
||||
exporter_class = LatexExporter
|
||||
should_include_raw = ["latex"]
|
||||
|
||||
def test_constructor(self):
|
||||
"""
|
||||
Can a LatexExporter be constructed?
|
||||
"""
|
||||
LatexExporter()
|
||||
|
||||
@onlyif_cmds_exist("pandoc")
|
||||
def test_export(self):
|
||||
"""
|
||||
Can a LatexExporter export something?
|
||||
"""
|
||||
(output, resources) = LatexExporter().from_filename(self._get_notebook())
|
||||
assert len(output) > 0
|
||||
|
||||
@onlyif_cmds_exist("pandoc")
|
||||
def test_export_book(self):
|
||||
"""
|
||||
Can a LatexExporter export using 'report' template?
|
||||
"""
|
||||
(output, resources) = LatexExporter(template_file="report").from_filename(
|
||||
self._get_notebook()
|
||||
)
|
||||
assert len(output) > 0
|
||||
|
||||
@onlyif_cmds_exist("pandoc")
|
||||
def test_very_long_cells(self):
|
||||
"""
|
||||
Torture test that long cells do not cause issues
|
||||
"""
|
||||
lorem_ipsum_text = textwrap.dedent(
|
||||
"""\
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec
|
||||
dignissim, ipsum non facilisis tempus, dui felis tincidunt metus,
|
||||
nec pulvinar neque odio eget risus. Nulla nisi lectus, cursus
|
||||
suscipit interdum at, ultrices sit amet orci. Mauris facilisis
|
||||
imperdiet elit, vitae scelerisque ipsum dignissim non. Integer
|
||||
consequat malesuada neque sit amet pulvinar. Curabitur pretium
|
||||
ut turpis eget aliquet. Maecenas sagittis lacus sed lectus
|
||||
volutpat, eu adipiscing purus pulvinar. Maecenas consequat
|
||||
luctus urna, eget cursus quam mollis a. Aliquam vitae ornare
|
||||
erat, non hendrerit urna. Sed eu diam nec massa egestas pharetra
|
||||
at nec tellus. Fusce feugiat lacus quis urna sollicitudin volutpat.
|
||||
Quisque at sapien non nibh feugiat tempus ac ultricies purus.
|
||||
"""
|
||||
)
|
||||
lorem_ipsum_text = lorem_ipsum_text.replace("\n", " ") + "\n\n"
|
||||
large_lorem_ipsum_text = "".join([lorem_ipsum_text] * 3000)
|
||||
|
||||
notebook_name = "lorem_ipsum_long.ipynb"
|
||||
nb = v4.new_notebook(cells=[v4.new_markdown_cell(source=large_lorem_ipsum_text)])
|
||||
|
||||
with TemporaryDirectory() as td:
|
||||
nbfile = os.path.join(td, notebook_name)
|
||||
with open(nbfile, "w") as f:
|
||||
write(nb, f, 4)
|
||||
|
||||
(output, resources) = LatexExporter().from_filename(nbfile)
|
||||
assert len(output) > 0
|
||||
|
||||
@onlyif_cmds_exist("pandoc")
|
||||
def test_prompt_number_color(self):
|
||||
"""
|
||||
Does LatexExporter properly format input and output prompts in color?
|
||||
"""
|
||||
(output, resources) = LatexExporter().from_filename(
|
||||
self._get_notebook(nb_name="prompt_numbers.ipynb")
|
||||
)
|
||||
|
||||
in_regex = r"\\prompt\{In\}\{incolor\}\{(\d+|\s*)\}"
|
||||
out_regex = r"\\prompt\{Out\}\{outcolor\}\{(\d+|\s*)\}"
|
||||
|
||||
ins = ["2", "10", " ", " ", "0"]
|
||||
outs = ["10"]
|
||||
|
||||
assert re.findall(in_regex, output) == ins
|
||||
assert re.findall(out_regex, output) == outs
|
||||
|
||||
@onlyif_cmds_exist("pandoc")
|
||||
def test_prompt_number_color_ipython(self):
|
||||
"""
|
||||
Does LatexExporter properly format input and output prompts in color?
|
||||
|
||||
Uses an in memory latex template to load style_ipython as the cell style.
|
||||
"""
|
||||
my_loader_tplx = DictLoader(
|
||||
{
|
||||
"my_template": r"""
|
||||
((* extends 'style_ipython.tex.j2' *))
|
||||
|
||||
((* block docclass *))
|
||||
\documentclass[11pt]{article}
|
||||
((* endblock docclass *))
|
||||
"""
|
||||
}
|
||||
)
|
||||
|
||||
class MyExporter(LatexExporter):
|
||||
template_file = "my_template"
|
||||
|
||||
(output, resources) = MyExporter(extra_loaders=[my_loader_tplx]).from_filename(
|
||||
self._get_notebook(nb_name="prompt_numbers.ipynb")
|
||||
)
|
||||
|
||||
in_regex = r"In \[\{\\color\{incolor\}(.*)\}\]:"
|
||||
out_regex = r"Out\[\{\\color\{outcolor\}(.*)\}\]:"
|
||||
|
||||
ins = ["2", "10", " ", " ", "0"]
|
||||
outs = ["10"]
|
||||
|
||||
assert re.findall(in_regex, output) == ins
|
||||
assert re.findall(out_regex, output) == outs
|
||||
|
||||
@onlyif_cmds_exist("pandoc")
|
||||
def test_no_prompt_yes_input(self):
|
||||
no_prompt = {
|
||||
"TemplateExporter": {
|
||||
"exclude_input_prompt": True,
|
||||
"exclude_output_prompt": True,
|
||||
}
|
||||
}
|
||||
c_no_prompt = Config(no_prompt)
|
||||
|
||||
exporter = LatexExporter(config=c_no_prompt)
|
||||
(output, resources) = exporter.from_filename(
|
||||
self._get_notebook(nb_name="prompt_numbers.ipynb")
|
||||
)
|
||||
assert "shape" in output
|
||||
assert "evs" in output
|
||||
|
||||
@onlyif_cmds_exist("pandoc", "inkscape")
|
||||
def test_svg(self):
|
||||
"""
|
||||
Can a LatexExporter export when it recieves raw binary strings form svg?
|
||||
"""
|
||||
filename = os.path.join(current_dir, "files", "svg.ipynb")
|
||||
(output, resources) = LatexExporter().from_filename(filename)
|
||||
assert len(output) > 0
|
||||
|
||||
def test_in_memory_template_tplx(self):
|
||||
# Loads in an in memory latex template (.tplx) using jinja2.DictLoader
|
||||
# creates a class that uses this template with the template_file argument
|
||||
# converts an empty notebook using this mechanism
|
||||
my_loader_tplx = DictLoader({"my_template": "{%- extends 'index' -%}"})
|
||||
|
||||
class MyExporter(LatexExporter):
|
||||
template_file = "my_template"
|
||||
|
||||
exporter = MyExporter(extra_loaders=[my_loader_tplx])
|
||||
nb = v4.new_notebook()
|
||||
out, resources = exporter.from_notebook_node(nb)
|
||||
|
||||
def test_custom_filter_highlight_code(self):
|
||||
# Overwriting filters takes place at: Exporter.from_notebook_node
|
||||
nb = v4.new_notebook()
|
||||
nb.cells.append(v4.new_code_cell("some_text"))
|
||||
|
||||
def custom_highlight_code(source, language="python", metadata=None, strip_verbatim=False):
|
||||
return source + " ADDED_TEXT"
|
||||
|
||||
filters = {"highlight_code": custom_highlight_code}
|
||||
(output, resources) = LatexExporter(filters=filters).from_notebook_node(nb)
|
||||
self.assertTrue("ADDED_TEXT" in output)
|
@ -0,0 +1,40 @@
|
||||
"""Tests for MarkdownExporter"""
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Copyright (c) 2013, the IPython Development Team.
|
||||
#
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
#
|
||||
# The full license is in the file COPYING.txt, distributed with this software.
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Imports
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
from ..markdown import MarkdownExporter
|
||||
from .base import ExportersTestsBase
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Class
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
class TestMarkdownExporter(ExportersTestsBase):
|
||||
"""Tests for MarkdownExporter"""
|
||||
|
||||
exporter_class = MarkdownExporter
|
||||
should_include_raw = ["markdown", "html"]
|
||||
|
||||
def test_constructor(self):
|
||||
"""
|
||||
Can a MarkdownExporter be constructed?
|
||||
"""
|
||||
MarkdownExporter()
|
||||
|
||||
def test_export(self):
|
||||
"""
|
||||
Can a MarkdownExporter export something?
|
||||
"""
|
||||
(output, resources) = MarkdownExporter().from_filename(self._get_notebook())
|
||||
assert len(output) > 0
|
@ -0,0 +1,41 @@
|
||||
"""Tests for notebook.py"""
|
||||
|
||||
# Copyright (c) IPython Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
import json
|
||||
|
||||
from nbformat import validate
|
||||
|
||||
from nbconvert.tests.base import assert_big_text_equal
|
||||
|
||||
from ..notebook import NotebookExporter
|
||||
from .base import ExportersTestsBase
|
||||
|
||||
|
||||
class TestNotebookExporter(ExportersTestsBase):
|
||||
"""Contains test functions for notebook.py"""
|
||||
|
||||
exporter_class = NotebookExporter
|
||||
|
||||
def test_export(self):
|
||||
"""
|
||||
Does the NotebookExporter return the file unchanged?
|
||||
"""
|
||||
with open(self._get_notebook()) as f:
|
||||
file_contents = f.read()
|
||||
(output, resources) = self.exporter_class().from_filename(self._get_notebook())
|
||||
assert len(output) > 0
|
||||
assert_big_text_equal(output, file_contents)
|
||||
|
||||
def test_downgrade_3(self):
|
||||
exporter = self.exporter_class(nbformat_version=3)
|
||||
(output, resources) = exporter.from_filename(self._get_notebook())
|
||||
nb = json.loads(output)
|
||||
validate(nb)
|
||||
|
||||
def test_downgrade_2(self):
|
||||
exporter = self.exporter_class(nbformat_version=2)
|
||||
(output, resources) = exporter.from_filename(self._get_notebook())
|
||||
nb = json.loads(output)
|
||||
self.assertEqual(nb["nbformat"], 2)
|
@ -0,0 +1,39 @@
|
||||
"""Tests for PDF export"""
|
||||
|
||||
# Copyright (c) IPython Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
import os
|
||||
import shutil
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from ...tests.utils import onlyif_cmds_exist
|
||||
from ..pdf import PDFExporter
|
||||
from .base import ExportersTestsBase
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Class
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
class TestPDF(ExportersTestsBase):
|
||||
"""Test PDF export"""
|
||||
|
||||
exporter_class = PDFExporter
|
||||
|
||||
def test_constructor(self):
|
||||
"""Can a PDFExporter be constructed?"""
|
||||
self.exporter_class()
|
||||
|
||||
@onlyif_cmds_exist("xelatex", "pandoc")
|
||||
def test_export(self):
|
||||
"""Smoke test PDFExporter"""
|
||||
with TemporaryDirectory() as td:
|
||||
file_name = os.path.basename(self._get_notebook())
|
||||
newpath = os.path.join(td, file_name)
|
||||
shutil.copy(self._get_notebook(), newpath)
|
||||
(output, resources) = self.exporter_class(latex_count=1).from_filename(newpath)
|
||||
self.assertIsInstance(output, bytes)
|
||||
assert len(output) > 0
|
||||
# all temporary file should be cleaned up
|
||||
assert {file_name} == set(os.listdir(td))
|
@ -0,0 +1,24 @@
|
||||
"""Tests for PythonExporter"""
|
||||
|
||||
# Copyright (c) IPython Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
from ..python import PythonExporter
|
||||
from .base import ExportersTestsBase
|
||||
|
||||
|
||||
class TestPythonExporter(ExportersTestsBase):
|
||||
"""Tests for PythonExporter"""
|
||||
|
||||
exporter_class = PythonExporter
|
||||
should_include_raw = ["python"]
|
||||
|
||||
def test_constructor(self):
|
||||
"""Can a PythonExporter be constructed?"""
|
||||
self.exporter_class()
|
||||
|
||||
def test_export(self):
|
||||
"""Can a PythonExporter export something?"""
|
||||
(output, resources) = self.exporter_class().from_filename(self._get_notebook())
|
||||
self.assertIn("coding: utf-8", output)
|
||||
self.assertIn("#!/usr/bin/env python", output)
|
@ -0,0 +1,67 @@
|
||||
"""Tests for RSTExporter"""
|
||||
|
||||
# Copyright (c) IPython Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
import re
|
||||
|
||||
import nbformat
|
||||
from nbformat import v4
|
||||
|
||||
from ...tests.utils import onlyif_cmds_exist
|
||||
from ..rst import RSTExporter
|
||||
from .base import ExportersTestsBase
|
||||
|
||||
|
||||
class TestRSTExporter(ExportersTestsBase):
|
||||
"""Tests for RSTExporter"""
|
||||
|
||||
exporter_class = RSTExporter
|
||||
should_include_raw = ["rst"]
|
||||
|
||||
def test_constructor(self):
|
||||
"""
|
||||
Can a RSTExporter be constructed?
|
||||
"""
|
||||
RSTExporter()
|
||||
|
||||
@onlyif_cmds_exist("pandoc")
|
||||
def test_export(self):
|
||||
"""
|
||||
Can a RSTExporter export something?
|
||||
"""
|
||||
(output, resources) = RSTExporter().from_filename(self._get_notebook())
|
||||
assert len(output) > 0
|
||||
|
||||
@onlyif_cmds_exist("pandoc")
|
||||
def test_empty_code_cell(self):
|
||||
"""No empty code cells in rst"""
|
||||
nbname = self._get_notebook()
|
||||
with open(nbname, encoding="utf8") as f:
|
||||
nb = nbformat.read(f, 4)
|
||||
|
||||
exporter = self.exporter_class()
|
||||
|
||||
(output, resources) = exporter.from_notebook_node(nb)
|
||||
# add an empty code cell
|
||||
nb.cells.append(v4.new_code_cell(source=""))
|
||||
(output2, resources) = exporter.from_notebook_node(nb)
|
||||
# adding an empty code cell shouldn't change output
|
||||
self.assertEqual(output.strip(), output2.strip())
|
||||
|
||||
@onlyif_cmds_exist("pandoc")
|
||||
def test_png_metadata(self):
|
||||
"""
|
||||
Does RSTExporter treat pngs with width/height metadata correctly?
|
||||
"""
|
||||
(output, resources) = RSTExporter().from_filename(
|
||||
self._get_notebook(nb_name="pngmetadata.ipynb")
|
||||
)
|
||||
assert len(output) > 0
|
||||
check_for_png = re.compile(r".. image::.*?\n\s+(.*?)\n\s*\n", re.DOTALL)
|
||||
result = check_for_png.search(output)
|
||||
assert result is not None
|
||||
attr_string = result.group(1)
|
||||
assert ":width:" in attr_string
|
||||
assert ":height:" in attr_string
|
||||
assert "px" in attr_string
|
@ -0,0 +1,75 @@
|
||||
"""Tests for ScriptExporter"""
|
||||
|
||||
# Copyright (c) IPython Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from nbformat import v4
|
||||
|
||||
import nbconvert
|
||||
|
||||
from ..script import ScriptExporter
|
||||
from .base import ExportersTestsBase
|
||||
|
||||
|
||||
class TestScriptExporter(ExportersTestsBase):
|
||||
"""Tests for ScriptExporter"""
|
||||
|
||||
exporter_class = ScriptExporter
|
||||
|
||||
def test_constructor(self):
|
||||
"""Construct ScriptExporter"""
|
||||
e = self.exporter_class()
|
||||
|
||||
def test_export(self):
|
||||
"""ScriptExporter can export something"""
|
||||
(output, resources) = self.exporter_class().from_filename(self._get_notebook())
|
||||
assert len(output) > 0
|
||||
|
||||
def test_export_python(self):
|
||||
"""delegate to custom exporter from language_info"""
|
||||
exporter = self.exporter_class()
|
||||
|
||||
pynb = v4.new_notebook()
|
||||
(output, resources) = self.exporter_class().from_notebook_node(pynb)
|
||||
self.assertNotIn("# coding: utf-8", output)
|
||||
|
||||
pynb.metadata.language_info = {
|
||||
"name": "python",
|
||||
"mimetype": "text/x-python",
|
||||
"nbconvert_exporter": "python",
|
||||
}
|
||||
(output, resources) = self.exporter_class().from_notebook_node(pynb)
|
||||
self.assertIn("# coding: utf-8", output)
|
||||
|
||||
def test_export_config_transfer(self):
|
||||
"""delegate config to custom exporter from language_info"""
|
||||
nb = v4.new_notebook()
|
||||
nb.metadata.language_info = {
|
||||
"name": "python",
|
||||
"mimetype": "text/x-python",
|
||||
"nbconvert_exporter": "python",
|
||||
}
|
||||
|
||||
exporter = self.exporter_class()
|
||||
exporter.from_notebook_node(nb)
|
||||
assert exporter._exporters["python"] != exporter
|
||||
assert exporter._exporters["python"].config == exporter.config
|
||||
|
||||
|
||||
def test_script_exporter_entrypoint():
|
||||
nb = v4.new_notebook()
|
||||
nb.metadata.language_info = {
|
||||
"name": "dummy",
|
||||
"mimetype": "text/x-dummy",
|
||||
}
|
||||
|
||||
p = os.path.join(os.path.dirname(nbconvert.tests.__file__), "exporter_entrypoint")
|
||||
sys.path.insert(0, p)
|
||||
try:
|
||||
output, _ = ScriptExporter().from_notebook_node(nb)
|
||||
assert output == "dummy-script-exported"
|
||||
finally:
|
||||
sys.path.remove(p)
|
@ -0,0 +1,82 @@
|
||||
"""Tests for SlidesExporter"""
|
||||
|
||||
# Copyright (c) IPython Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
from nbformat import v4 as nbformat
|
||||
|
||||
from ..slides import SlidesExporter, _RevealMetadataPreprocessor
|
||||
from .base import ExportersTestsBase
|
||||
|
||||
|
||||
class TestSlidesExporter(ExportersTestsBase):
|
||||
"""Tests for SlidesExporter"""
|
||||
|
||||
exporter_class = SlidesExporter
|
||||
should_include_raw = ["html"]
|
||||
|
||||
def test_constructor(self):
|
||||
"""
|
||||
Can a SlidesExporter be constructed?
|
||||
"""
|
||||
SlidesExporter()
|
||||
|
||||
def test_export(self):
|
||||
"""
|
||||
Can a SlidesExporter export something?
|
||||
"""
|
||||
(output, resources) = SlidesExporter().from_filename(self._get_notebook())
|
||||
assert len(output) > 0
|
||||
|
||||
def test_export_reveal(self):
|
||||
"""
|
||||
Can a SlidesExporter export using the 'reveal' template?
|
||||
"""
|
||||
(output, resources) = SlidesExporter().from_filename(self._get_notebook())
|
||||
assert len(output) > 0
|
||||
|
||||
def build_notebook(self):
|
||||
"""Build a reveal slides notebook in memory for use with tests."""
|
||||
outputs = [nbformat.new_output(output_type="stream", name="stdout", text="a")]
|
||||
|
||||
slide_metadata = {"slideshow": {"slide_type": "slide"}}
|
||||
subslide_metadata = {"slideshow": {"slide_type": "subslide"}}
|
||||
fragment_metadata = {"slideshow": {"slide_type": "fragment"}}
|
||||
|
||||
cells = [
|
||||
nbformat.new_code_cell(source="", execution_count=1, outputs=outputs),
|
||||
nbformat.new_markdown_cell(source="", metadata=slide_metadata),
|
||||
nbformat.new_code_cell(source="", execution_count=2, outputs=outputs),
|
||||
nbformat.new_markdown_cell(source="", metadata=slide_metadata),
|
||||
nbformat.new_markdown_cell(source="", metadata=subslide_metadata),
|
||||
nbformat.new_markdown_cell(source="", metadata=fragment_metadata),
|
||||
nbformat.new_code_cell(source="", execution_count=1, outputs=outputs),
|
||||
]
|
||||
|
||||
return nbformat.new_notebook(cells=cells)
|
||||
|
||||
def test_metadata_preprocessor(self):
|
||||
preprocessor = _RevealMetadataPreprocessor()
|
||||
nb = self.build_notebook()
|
||||
nb, resources = preprocessor.preprocess(nb)
|
||||
cells = nb.cells
|
||||
|
||||
# Make sure correct metadata tags are available on every cell.
|
||||
for cell in cells:
|
||||
assert "slide_type" in cell.metadata
|
||||
|
||||
# Make sure slide end is only applied to the cells preceeding slide
|
||||
# cells.
|
||||
assert not cells[1].metadata.get("slide_end", False)
|
||||
|
||||
# Verify 'slide-end'
|
||||
assert cells[0].metadata["slide_end"]
|
||||
assert cells[2].metadata["slide_end"]
|
||||
assert cells[2].metadata["subslide_end"]
|
||||
|
||||
assert not cells[3].metadata.get("slide_end", False)
|
||||
assert cells[3].metadata["subslide_end"]
|
||||
|
||||
assert cells[-1].metadata["fragment_end"]
|
||||
assert cells[-1].metadata["subslide_end"]
|
||||
assert cells[-1].metadata["slide_end"]
|
@ -0,0 +1,653 @@
|
||||
"""
|
||||
Module with tests for templateexporter.py
|
||||
"""
|
||||
|
||||
# Copyright (c) Jupyter Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
import json
|
||||
import os
|
||||
from concurrent.futures import ProcessPoolExecutor
|
||||
from tempfile import TemporaryDirectory
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from jinja2 import TemplateNotFound
|
||||
from nbformat import v4
|
||||
from traitlets import default
|
||||
from traitlets.config import Config
|
||||
|
||||
from ...utils import _contextlib_chdir
|
||||
from ..html import HTMLExporter
|
||||
from ..markdown import MarkdownExporter
|
||||
from ..rst import RSTExporter
|
||||
from ..templateexporter import TemplateExporter
|
||||
from .base import ExportersTestsBase
|
||||
from .cheese import CheesePreprocessor
|
||||
|
||||
raw_template = """{%- extends 'index.rst.j2' -%}
|
||||
{%- block in_prompt -%}
|
||||
blah
|
||||
{%- endblock in_prompt -%}
|
||||
"""
|
||||
|
||||
|
||||
class SampleExporter(TemplateExporter):
|
||||
"""
|
||||
Exports a Python code file.
|
||||
"""
|
||||
|
||||
@default("file_extension")
|
||||
def _file_extension_default(self):
|
||||
return ".py"
|
||||
|
||||
@default("template_name")
|
||||
def _template_name_default(self):
|
||||
return "python"
|
||||
|
||||
|
||||
class TestExporter(ExportersTestsBase):
|
||||
"""Contains test functions for exporter.py"""
|
||||
|
||||
def test_constructor(self):
|
||||
"""
|
||||
Can a TemplateExporter be constructed?
|
||||
"""
|
||||
TemplateExporter()
|
||||
|
||||
def test_export(self):
|
||||
"""
|
||||
Can a TemplateExporter export something?
|
||||
"""
|
||||
exporter = self._make_exporter()
|
||||
(output, resources) = exporter.from_filename(self._get_notebook())
|
||||
assert len(output) > 0
|
||||
|
||||
def test_extract_outputs(self):
|
||||
"""
|
||||
If the ExtractOutputPreprocessor is enabled, are outputs extracted?
|
||||
"""
|
||||
config = Config({"ExtractOutputPreprocessor": {"enabled": True}})
|
||||
exporter = self._make_exporter(config=config)
|
||||
(output, resources) = exporter.from_filename(self._get_notebook())
|
||||
assert resources is not None
|
||||
assert isinstance(resources["outputs"], dict)
|
||||
assert len(resources["outputs"]) > 0
|
||||
|
||||
def test_preprocessor_class(self):
|
||||
"""
|
||||
Can a preprocessor be added to the preprocessors list by class type?
|
||||
"""
|
||||
config = Config({"Exporter": {"preprocessors": [CheesePreprocessor]}})
|
||||
exporter = self._make_exporter(config=config)
|
||||
(output, resources) = exporter.from_filename(self._get_notebook())
|
||||
assert resources is not None
|
||||
assert resources["cheese"] == "real"
|
||||
|
||||
def test_preprocessor_instance(self):
|
||||
"""
|
||||
Can a preprocessor be added to the preprocessors list by instance?
|
||||
"""
|
||||
config = Config({"Exporter": {"preprocessors": [CheesePreprocessor()]}})
|
||||
exporter = self._make_exporter(config=config)
|
||||
(output, resources) = exporter.from_filename(self._get_notebook())
|
||||
assert resources is not None
|
||||
assert resources["cheese"] == "real"
|
||||
|
||||
def test_preprocessor_dottedobjectname(self):
|
||||
"""
|
||||
Can a preprocessor be added to the preprocessors list by dotted object name?
|
||||
"""
|
||||
config = Config(
|
||||
{"Exporter": {"preprocessors": ["nbconvert.exporters.tests.cheese.CheesePreprocessor"]}}
|
||||
)
|
||||
exporter = self._make_exporter(config=config)
|
||||
(output, resources) = exporter.from_filename(self._get_notebook())
|
||||
assert resources is not None
|
||||
assert resources["cheese"] == "real"
|
||||
|
||||
def test_preprocessor_via_method(self):
|
||||
"""
|
||||
Can a preprocessor be added via the Exporter convenience method?
|
||||
"""
|
||||
exporter = self._make_exporter()
|
||||
exporter.register_preprocessor(CheesePreprocessor, enabled=True)
|
||||
(output, resources) = exporter.from_filename(self._get_notebook())
|
||||
assert resources is not None
|
||||
assert resources["cheese"] == "real"
|
||||
|
||||
def test_pickle(self):
|
||||
"""
|
||||
Can exporters be pickled & called across processes?
|
||||
"""
|
||||
exporter = self._make_exporter()
|
||||
executor = ProcessPoolExecutor()
|
||||
(output, resources) = executor.submit(exporter.from_filename, self._get_notebook()).result()
|
||||
assert len(output) > 0
|
||||
|
||||
def test_absolute_template_file(self):
|
||||
with TemporaryDirectory() as td:
|
||||
template = os.path.join(td, "abstemplate.ext.j2")
|
||||
test_output = "absolute!"
|
||||
with open(template, "w") as f:
|
||||
f.write(test_output)
|
||||
config = Config()
|
||||
config.TemplateExporter.template_file = template
|
||||
exporter = self._make_exporter(config=config)
|
||||
assert exporter.template.filename == template
|
||||
assert os.path.dirname(template) in exporter.template_paths
|
||||
|
||||
def test_relative_template_file(self):
|
||||
with TemporaryDirectory() as td, _contextlib_chdir.chdir(td):
|
||||
with patch("os.getcwd", return_value=os.path.abspath(td)):
|
||||
template = os.path.join("relative", "relative_template.ext.j2")
|
||||
template_abs = os.path.abspath(os.path.join(td, template))
|
||||
os.mkdir(os.path.dirname(template_abs))
|
||||
test_output = "relative!"
|
||||
with open(template_abs, "w") as f:
|
||||
f.write(test_output)
|
||||
config = Config()
|
||||
config.TemplateExporter.template_file = template
|
||||
exporter = self._make_exporter(config=config)
|
||||
assert os.path.abspath(exporter.template.filename) == template_abs
|
||||
assert os.path.dirname(template_abs) in [
|
||||
os.path.abspath(d) for d in exporter.template_paths
|
||||
]
|
||||
|
||||
def test_absolute_template_file_compatibility(self):
|
||||
with TemporaryDirectory() as td:
|
||||
template = os.path.join(td, "abstemplate.tpl")
|
||||
test_output = "absolute!"
|
||||
with open(template, "w") as f:
|
||||
f.write(test_output)
|
||||
config = Config()
|
||||
config.TemplateExporter.template_file = template
|
||||
with pytest.warns(DeprecationWarning):
|
||||
exporter = self._make_exporter(config=config)
|
||||
assert exporter.template.filename == template
|
||||
assert os.path.dirname(template) in exporter.template_paths
|
||||
|
||||
def test_relative_template_file_compatibility(self):
|
||||
with TemporaryDirectory() as td, _contextlib_chdir.chdir(td):
|
||||
with patch("os.getcwd", return_value=os.path.abspath(td)):
|
||||
template = os.path.join("relative", "relative_template.tpl")
|
||||
template_abs = os.path.abspath(os.path.join(td, template))
|
||||
os.mkdir(os.path.dirname(template_abs))
|
||||
test_output = "relative!"
|
||||
with open(template_abs, "w") as f:
|
||||
f.write(test_output)
|
||||
config = Config()
|
||||
config.TemplateExporter.template_file = template
|
||||
with pytest.warns(DeprecationWarning):
|
||||
exporter = self._make_exporter(config=config)
|
||||
assert os.path.abspath(exporter.template.filename) == template_abs
|
||||
assert os.path.dirname(template_abs) in [
|
||||
os.path.abspath(d) for d in exporter.template_paths
|
||||
]
|
||||
|
||||
def test_absolute_template_name_tpl_compatibility(self):
|
||||
with TemporaryDirectory() as td:
|
||||
template = os.path.join(td, "abstemplate.tpl")
|
||||
test_output = "absolute!"
|
||||
with open(template, "w") as f:
|
||||
f.write(test_output)
|
||||
config = Config()
|
||||
# We're setting the template_name instead of the template_file
|
||||
config.TemplateExporter.template_name = template
|
||||
with pytest.warns(DeprecationWarning):
|
||||
exporter = self._make_exporter(config=config)
|
||||
assert exporter.template.filename == template
|
||||
assert os.path.dirname(template) in exporter.template_paths
|
||||
|
||||
# Can't use @pytest.mark.parametrize without removing all self.assert calls in all tests... repeating some here
|
||||
def absolute_template_name_5x_compatibility_test(self, template, mimetype=None):
|
||||
config = Config()
|
||||
# We're setting the template_name instead of the template_file
|
||||
config.TemplateExporter.template_name = template
|
||||
with pytest.warns(DeprecationWarning):
|
||||
exporter = self._make_exporter(config=config)
|
||||
template_dir, template_file = os.path.split(exporter.template.filename)
|
||||
_, compat_dir = os.path.split(template_dir)
|
||||
assert compat_dir == "compatibility"
|
||||
assert template_file == template + ".tpl"
|
||||
assert template_dir in exporter.template_paths
|
||||
|
||||
def test_absolute_template_name_5x_compatibility_full(self):
|
||||
self.absolute_template_name_5x_compatibility_test("full", "text/html")
|
||||
|
||||
def test_absolute_template_name_5x_compatibility_display_priority(self):
|
||||
self.absolute_template_name_5x_compatibility_test("display_priority")
|
||||
|
||||
# Can't use @pytest.mark.parametrize without removing all self.assert calls in all tests... repeating some here
|
||||
def relative_template_test(self, template):
|
||||
with TemporaryDirectory() as td, _contextlib_chdir.chdir(td):
|
||||
with patch("os.getcwd", return_value=os.path.abspath(td)):
|
||||
template_abs = os.path.abspath(os.path.join(td, template))
|
||||
dirname = os.path.dirname(template_abs)
|
||||
if not os.path.exists(dirname):
|
||||
os.mkdir(dirname)
|
||||
test_output = "relative!"
|
||||
with open(template_abs, "w") as f:
|
||||
f.write(test_output)
|
||||
config = Config()
|
||||
# We're setting the template_name instead of the template_file
|
||||
config.TemplateExporter.template_name = template
|
||||
with pytest.warns(DeprecationWarning):
|
||||
exporter = self._make_exporter(config=config)
|
||||
assert os.path.abspath(exporter.template.filename) == template_abs
|
||||
assert os.path.dirname(template_abs) in [
|
||||
os.path.abspath(d) for d in exporter.template_paths
|
||||
]
|
||||
|
||||
def test_relative_template_name_tpl_compatibility_local(self):
|
||||
self.relative_template_test("relative_template.tpl")
|
||||
|
||||
def test_relative_template_name_tpl_compatibility_nested(self):
|
||||
self.relative_template_test(os.path.join("relative", "relative_template.tpl"))
|
||||
|
||||
def test_relative_template_name_tpl_compatibility_dot(self):
|
||||
self.relative_template_test(os.path.join(".", "relative_template.tpl"))
|
||||
|
||||
def test_relative_template_name_tpl_compatibility_dot_nested(self):
|
||||
self.relative_template_test(os.path.join(".", "relative", "relative_template.tpl"))
|
||||
|
||||
def test_absolute_template_dir(self):
|
||||
with TemporaryDirectory() as td:
|
||||
template = "mytemplate"
|
||||
template_file = os.path.join(td, template, "index.py.j2")
|
||||
template_dir = os.path.dirname(template_file)
|
||||
os.mkdir(template_dir)
|
||||
test_output = "absolute!"
|
||||
with open(template_file, "w") as f:
|
||||
f.write(test_output)
|
||||
config = Config()
|
||||
config.TemplateExporter.template_name = template
|
||||
config.TemplateExporter.extra_template_basedirs = [td]
|
||||
exporter = self._make_exporter(config=config)
|
||||
assert exporter.template.filename == template_file
|
||||
assert exporter.template_name == template
|
||||
assert os.path.join(td, template) in exporter.template_paths
|
||||
|
||||
def test_local_template_dir(self):
|
||||
with TemporaryDirectory() as td, _contextlib_chdir.chdir(td):
|
||||
with patch("os.getcwd", return_value=os.path.abspath(td)):
|
||||
template = "mytemplate"
|
||||
template_file = os.path.join(template, "index.py.j2")
|
||||
template_abs = os.path.abspath(os.path.join(td, template_file))
|
||||
template_conf = os.path.abspath(os.path.join(td, template, "conf.json"))
|
||||
os.mkdir(os.path.dirname(template_abs))
|
||||
test_output = "local!"
|
||||
with open(template_abs, "w") as f:
|
||||
f.write(test_output)
|
||||
with open(template_conf, "w") as f:
|
||||
# Mimic having a superset of accepted mimetypes
|
||||
f.write(
|
||||
json.dumps(
|
||||
Config(
|
||||
mimetypes={
|
||||
"text/x-python": True,
|
||||
"text/html": True,
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
config = Config()
|
||||
config.TemplateExporter.template_name = template
|
||||
exporter = self._make_exporter(config=config)
|
||||
assert os.path.abspath(exporter.template.filename) == template_abs
|
||||
assert exporter.template_name == template
|
||||
assert os.path.join(td, template) in exporter.template_paths
|
||||
|
||||
def test_local_template_file_extending_lab(self):
|
||||
template_file = os.path.join(self._get_files_path(), "lablike.html.j2")
|
||||
exporter = HTMLExporter(template_file=template_file, template_name="lab")
|
||||
nb = v4.new_notebook()
|
||||
nb.cells.append(v4.new_code_cell("some_text"))
|
||||
output, resources = exporter.from_notebook_node(nb)
|
||||
assert "UNIQUE" in output
|
||||
|
||||
def test_raw_template_attr(self):
|
||||
"""
|
||||
Verify that you can assign a in memory template string by overwriting
|
||||
`raw_template` as simple(non-traitlet) attribute
|
||||
"""
|
||||
nb = v4.new_notebook()
|
||||
nb.cells.append(v4.new_code_cell("some_text"))
|
||||
|
||||
class AttrExporter(TemplateExporter):
|
||||
raw_template = raw_template
|
||||
|
||||
exporter_attr = AttrExporter(template_name="rst")
|
||||
output_attr, _ = exporter_attr.from_notebook_node(nb)
|
||||
assert "blah" in output_attr
|
||||
|
||||
def test_raw_template_init(self):
|
||||
"""
|
||||
Test that template_file and raw_template traitlets play nicely together.
|
||||
- source assigns template_file default first, then raw_template
|
||||
- checks that the raw_template overrules template_file if set
|
||||
- checks that once raw_template is set to '', template_file returns
|
||||
"""
|
||||
nb = v4.new_notebook()
|
||||
nb.cells.append(v4.new_code_cell("some_text"))
|
||||
|
||||
class AttrExporter(RSTExporter):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.raw_template = raw_template
|
||||
|
||||
exporter_init = AttrExporter()
|
||||
output_init, _ = exporter_init.from_notebook_node(nb)
|
||||
assert "blah" in output_init
|
||||
exporter_init.raw_template = ""
|
||||
assert exporter_init.template_file == "index.rst.j2"
|
||||
output_init, _ = exporter_init.from_notebook_node(nb)
|
||||
assert "blah" not in output_init
|
||||
|
||||
def test_raw_template_dynamic_attr(self):
|
||||
"""
|
||||
Test that template_file and raw_template traitlets play nicely together.
|
||||
- source assigns template_file default first, then raw_template
|
||||
- checks that the raw_template overrules template_file if set
|
||||
- checks that once raw_template is set to '', template_file returns
|
||||
"""
|
||||
nb = v4.new_notebook()
|
||||
nb.cells.append(v4.new_code_cell("some_text"))
|
||||
|
||||
class AttrDynamicExporter(TemplateExporter):
|
||||
@default("default_template_file")
|
||||
def _template_file_default(self):
|
||||
return "index.rst.j2"
|
||||
|
||||
@default("raw_template")
|
||||
def _raw_template_default(self):
|
||||
return raw_template
|
||||
|
||||
exporter_attr_dynamic = AttrDynamicExporter(template_name="rst")
|
||||
output_attr_dynamic, _ = exporter_attr_dynamic.from_notebook_node(nb)
|
||||
assert "blah" in output_attr_dynamic
|
||||
exporter_attr_dynamic.raw_template = ""
|
||||
assert exporter_attr_dynamic.template_file == "index.rst.j2"
|
||||
output_attr_dynamic, _ = exporter_attr_dynamic.from_notebook_node(nb)
|
||||
assert "blah" not in output_attr_dynamic
|
||||
|
||||
def test_raw_template_dynamic_attr_reversed(self):
|
||||
"""
|
||||
Test that template_file and raw_template traitlets play nicely together.
|
||||
- source assigns raw_template default first, then template_file
|
||||
- checks that the raw_template overrules template_file if set
|
||||
- checks that once raw_template is set to '', template_file returns
|
||||
"""
|
||||
nb = v4.new_notebook()
|
||||
nb.cells.append(v4.new_code_cell("some_text"))
|
||||
|
||||
class AttrDynamicExporter(TemplateExporter):
|
||||
@default("raw_template")
|
||||
def _raw_template_default(self):
|
||||
return raw_template
|
||||
|
||||
@default("default_template_file")
|
||||
def _template_file_default(self):
|
||||
return "index.rst.j2"
|
||||
|
||||
exporter_attr_dynamic = AttrDynamicExporter(template_name="rst")
|
||||
output_attr_dynamic, _ = exporter_attr_dynamic.from_notebook_node(nb)
|
||||
assert "blah" in output_attr_dynamic
|
||||
exporter_attr_dynamic.raw_template = ""
|
||||
assert exporter_attr_dynamic.template_file == "index.rst.j2"
|
||||
output_attr_dynamic, _ = exporter_attr_dynamic.from_notebook_node(nb)
|
||||
assert "blah" not in output_attr_dynamic
|
||||
|
||||
def test_raw_template_constructor(self):
|
||||
"""
|
||||
Test `raw_template` as a keyword argument in the exporter constructor.
|
||||
"""
|
||||
nb = v4.new_notebook()
|
||||
nb.cells.append(v4.new_code_cell("some_text"))
|
||||
|
||||
output_constructor, _ = TemplateExporter(
|
||||
template_name="rst", raw_template=raw_template
|
||||
).from_notebook_node(nb)
|
||||
assert "blah" in output_constructor
|
||||
|
||||
def test_raw_template_assignment(self):
|
||||
"""
|
||||
Test `raw_template` assigned after the fact on non-custom Exporter.
|
||||
"""
|
||||
nb = v4.new_notebook()
|
||||
nb.cells.append(v4.new_code_cell("some_text"))
|
||||
exporter_assign = TemplateExporter(template_name="rst")
|
||||
exporter_assign.raw_template = raw_template
|
||||
output_assign, _ = exporter_assign.from_notebook_node(nb)
|
||||
assert "blah" in output_assign
|
||||
|
||||
def test_raw_template_reassignment(self):
|
||||
"""
|
||||
Test `raw_template` reassigned after the fact on non-custom Exporter.
|
||||
"""
|
||||
nb = v4.new_notebook()
|
||||
nb.cells.append(v4.new_code_cell("some_text"))
|
||||
exporter_reassign = TemplateExporter(template_name="rst")
|
||||
exporter_reassign.raw_template = raw_template
|
||||
output_reassign, _ = exporter_reassign.from_notebook_node(nb)
|
||||
assert "blah" in output_reassign
|
||||
exporter_reassign.raw_template = raw_template.replace("blah", "baz")
|
||||
output_reassign, _ = exporter_reassign.from_notebook_node(nb)
|
||||
assert "baz" in output_reassign
|
||||
|
||||
def test_raw_template_deassignment(self):
|
||||
"""
|
||||
Test `raw_template` does not overwrite template_file if deassigned after
|
||||
being assigned to a non-custom Exporter.
|
||||
"""
|
||||
nb = v4.new_notebook()
|
||||
nb.cells.append(v4.new_code_cell("some_text"))
|
||||
exporter_deassign = RSTExporter()
|
||||
exporter_deassign.raw_template = raw_template
|
||||
output_deassign, _ = exporter_deassign.from_notebook_node(nb)
|
||||
assert "blah" in output_deassign
|
||||
exporter_deassign.raw_template = ""
|
||||
assert exporter_deassign.template_file == "index.rst.j2"
|
||||
output_deassign, _ = exporter_deassign.from_notebook_node(nb)
|
||||
assert "blah" not in output_deassign
|
||||
|
||||
def test_raw_template_dereassignment(self):
|
||||
"""
|
||||
Test `raw_template` does not overwrite template_file if deassigned after
|
||||
being assigned to a non-custom Exporter.
|
||||
"""
|
||||
nb = v4.new_notebook()
|
||||
nb.cells.append(v4.new_code_cell("some_text"))
|
||||
exporter_dereassign = RSTExporter()
|
||||
exporter_dereassign.raw_template = raw_template
|
||||
output_dereassign, _ = exporter_dereassign.from_notebook_node(nb)
|
||||
assert "blah" in output_dereassign
|
||||
exporter_dereassign.raw_template = raw_template.replace("blah", "baz")
|
||||
output_dereassign, _ = exporter_dereassign.from_notebook_node(nb)
|
||||
assert "baz" in output_dereassign
|
||||
exporter_dereassign.raw_template = ""
|
||||
assert exporter_dereassign.template_file == "index.rst.j2"
|
||||
output_dereassign, _ = exporter_dereassign.from_notebook_node(nb)
|
||||
assert "blah" not in output_dereassign
|
||||
|
||||
def test_fail_to_find_template_file(self):
|
||||
# Create exporter with invalid template file, check that it doesn't
|
||||
# exist in the environment, try to convert empty notebook. Failure is
|
||||
# expected due to nonexistant template file.
|
||||
|
||||
template = "does_not_exist.tpl"
|
||||
exporter = TemplateExporter(template_file=template)
|
||||
assert template not in exporter.environment.list_templates(extensions=["tpl"])
|
||||
nb = v4.new_notebook()
|
||||
with pytest.raises(TemplateNotFound):
|
||||
out, resources = exporter.from_notebook_node(nb)
|
||||
|
||||
def test_exclude_code_cell(self):
|
||||
no_io = {
|
||||
"TemplateExporter": {
|
||||
"exclude_output": True,
|
||||
"exclude_input": True,
|
||||
"exclude_input_prompt": False,
|
||||
"exclude_output_prompt": False,
|
||||
"exclude_markdown": False,
|
||||
"exclude_code_cell": False,
|
||||
"exclude_output_stdin": True,
|
||||
}
|
||||
}
|
||||
c_no_io = Config(no_io)
|
||||
exporter_no_io = TemplateExporter(config=c_no_io, template_name="markdown")
|
||||
exporter_no_io.template_file = "index.md.j2"
|
||||
nb_no_io, resources_no_io = exporter_no_io.from_filename(self._get_notebook())
|
||||
|
||||
assert not resources_no_io["global_content_filter"]["include_input"]
|
||||
assert not resources_no_io["global_content_filter"]["include_output"]
|
||||
|
||||
no_code = {
|
||||
"TemplateExporter": {
|
||||
"exclude_output": False,
|
||||
"exclude_input": False,
|
||||
"exclude_input_prompt": False,
|
||||
"exclude_output_prompt": False,
|
||||
"exclude_markdown": False,
|
||||
"exclude_code_cell": True,
|
||||
"exclude_output_stdin": True,
|
||||
}
|
||||
}
|
||||
c_no_code = Config(no_code)
|
||||
exporter_no_code = TemplateExporter(config=c_no_code, template_name="markdown")
|
||||
exporter_no_code.template_file = "index.md.j2"
|
||||
nb_no_code, resources_no_code = exporter_no_code.from_filename(self._get_notebook())
|
||||
|
||||
assert not resources_no_code["global_content_filter"]["include_code"]
|
||||
assert nb_no_io == nb_no_code
|
||||
|
||||
def test_exclude_input_prompt(self):
|
||||
no_input_prompt = {
|
||||
"TemplateExporter": {
|
||||
"exclude_output": False,
|
||||
"exclude_input": False,
|
||||
"exclude_input_prompt": True,
|
||||
"exclude_output_prompt": False,
|
||||
"exclude_markdown": False,
|
||||
"exclude_code_cell": False,
|
||||
"exclude_output_stdin": True,
|
||||
}
|
||||
}
|
||||
c_no_input_prompt = Config(no_input_prompt)
|
||||
exporter_no_input_prompt = MarkdownExporter(config=c_no_input_prompt)
|
||||
nb_no_input_prompt, resources_no_input_prompt = exporter_no_input_prompt.from_filename(
|
||||
self._get_notebook()
|
||||
)
|
||||
|
||||
assert not resources_no_input_prompt["global_content_filter"]["include_input_prompt"]
|
||||
assert "# In[" not in nb_no_input_prompt
|
||||
|
||||
def test_exclude_markdown(self):
|
||||
|
||||
no_md = {
|
||||
"TemplateExporter": {
|
||||
"exclude_output": False,
|
||||
"exclude_input": False,
|
||||
"exclude_input_prompt": False,
|
||||
"exclude_output_prompt": False,
|
||||
"exclude_markdown": True,
|
||||
"exclude_code_cell": False,
|
||||
"exclude_output_stdin": True,
|
||||
}
|
||||
}
|
||||
|
||||
c_no_md = Config(no_md)
|
||||
exporter_no_md = TemplateExporter(config=c_no_md, template_name="python")
|
||||
exporter_no_md.template_file = "index.py.j2"
|
||||
nb_no_md, resources_no_md = exporter_no_md.from_filename(self._get_notebook())
|
||||
|
||||
assert not resources_no_md["global_content_filter"]["include_markdown"]
|
||||
assert "First import NumPy and Matplotlib" not in nb_no_md
|
||||
|
||||
def test_exclude_output_prompt(self):
|
||||
no_output_prompt = {
|
||||
"TemplateExporter": {
|
||||
"exclude_output": False,
|
||||
"exclude_input": False,
|
||||
"exclude_input_prompt": False,
|
||||
"exclude_output_prompt": True,
|
||||
"exclude_markdown": False,
|
||||
"exclude_code_cell": False,
|
||||
"exclude_output_stdin": True,
|
||||
}
|
||||
}
|
||||
c_no_output_prompt = Config(no_output_prompt)
|
||||
exporter_no_output_prompt = HTMLExporter(config=c_no_output_prompt)
|
||||
nb_no_output_prompt, resources_no_output_prompt = exporter_no_output_prompt.from_filename(
|
||||
self._get_notebook()
|
||||
)
|
||||
|
||||
assert not resources_no_output_prompt["global_content_filter"]["include_output_prompt"]
|
||||
assert "Out[1]" not in nb_no_output_prompt
|
||||
|
||||
def test_exclude_output_stdin(self):
|
||||
no_output_stdin = {
|
||||
"TemplateExporter": {
|
||||
"exclude_output": False,
|
||||
"exclude_input": False,
|
||||
"exclude_input_prompt": False,
|
||||
"exclude_output_prompt": True,
|
||||
"exclude_markdown": False,
|
||||
"exclude_code_cell": False,
|
||||
"exclude_output_stdin": True,
|
||||
}
|
||||
}
|
||||
c_no_output_stdin = Config(no_output_stdin)
|
||||
exporter_no_output_prompt = HTMLExporter(config=c_no_output_stdin)
|
||||
|
||||
nb_no_output_stdin, resources_no_output_stdin = exporter_no_output_prompt.from_filename(
|
||||
self._get_notebook("notebook3.ipynb")
|
||||
)
|
||||
|
||||
assert not resources_no_output_stdin["global_content_filter"]["include_output_stdin"]
|
||||
assert "test input: input value" not in nb_no_output_stdin
|
||||
|
||||
def test_include_output_stdin(self):
|
||||
output_stdin = {
|
||||
"TemplateExporter": {
|
||||
"exclude_output": False,
|
||||
"exclude_input": False,
|
||||
"exclude_input_prompt": False,
|
||||
"exclude_output_prompt": True,
|
||||
"exclude_markdown": False,
|
||||
"exclude_code_cell": False,
|
||||
"exclude_output_stdin": False,
|
||||
}
|
||||
}
|
||||
c_output_stdin = Config(output_stdin)
|
||||
exporter_output_stdin = HTMLExporter(config=c_output_stdin)
|
||||
|
||||
nb_output_stdin, resources_output_stdin = exporter_output_stdin.from_filename(
|
||||
self._get_notebook("notebook3.ipynb")
|
||||
)
|
||||
|
||||
assert resources_output_stdin["global_content_filter"]["include_output_stdin"]
|
||||
assert "test input: input value" in nb_output_stdin
|
||||
|
||||
def test_remove_elements_with_tags(self):
|
||||
|
||||
conf = Config(
|
||||
{
|
||||
"TagRemovePreprocessor": {
|
||||
"remove_cell_tags": ["remove_cell"],
|
||||
"remove_all_outputs_tags": ["remove_output"],
|
||||
"remove_input_tags": ["remove_input"],
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
exporter = MarkdownExporter(config=conf)
|
||||
nb, resources = exporter.from_filename(self._get_notebook())
|
||||
|
||||
assert "hist(evs.real)" not in nb
|
||||
assert "cell is just markdown testing whether" not in nb
|
||||
assert "(100,)" not in nb
|
||||
|
||||
def _make_exporter(self, config=None):
|
||||
exporter = SampleExporter(config=config)
|
||||
return exporter
|
@ -0,0 +1,47 @@
|
||||
"""Tests for the latex preprocessor"""
|
||||
|
||||
# Copyright (c) IPython Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from ..webpdf import WebPDFExporter
|
||||
from .base import ExportersTestsBase
|
||||
|
||||
|
||||
class TestWebPDFExporter(ExportersTestsBase):
|
||||
"""Contains test functions for webpdf.py"""
|
||||
|
||||
exporter_class = WebPDFExporter
|
||||
|
||||
@pytest.mark.network
|
||||
def test_export(self):
|
||||
"""
|
||||
Can a TemplateExporter export something?
|
||||
"""
|
||||
(output, resources) = WebPDFExporter(allow_chromium_download=True).from_filename(
|
||||
self._get_notebook()
|
||||
)
|
||||
assert len(output) > 0
|
||||
|
||||
@patch("pyppeteer.util.check_chromium", return_value=False)
|
||||
def test_webpdf_without_chromium(self, mock_check_chromium):
|
||||
"""
|
||||
Generate PDFs if chromium not present?
|
||||
"""
|
||||
with pytest.raises(RuntimeError):
|
||||
WebPDFExporter(allow_chromium_download=False).from_filename(self._get_notebook())
|
||||
|
||||
def test_webpdf_without_pyppeteer(self):
|
||||
"""
|
||||
Generate PDFs if chromium not present?
|
||||
"""
|
||||
with pytest.raises(RuntimeError):
|
||||
exporter = WebPDFExporter()
|
||||
with open(self._get_notebook(), encoding="utf-8") as f:
|
||||
nb = exporter.from_file(f, resources={})
|
||||
# Have to do this as the very last action as traitlets do dynamic importing often
|
||||
with patch("builtins.__import__", side_effect=ModuleNotFoundError("Fake missing")):
|
||||
exporter.from_notebook_node(nb)
|
Reference in New Issue
Block a user