Show More
@@ -0,0 +1,155 | |||||
|
1 | { | |||
|
2 | "metadata": { | |||
|
3 | "cell_tags": ["<None>", null], | |||
|
4 | "name": "", | |||
|
5 | "kernel_info": { | |||
|
6 | "name": "python", | |||
|
7 | "language": "python" | |||
|
8 | } | |||
|
9 | }, | |||
|
10 | "nbformat": 4, | |||
|
11 | "nbformat_minor": 0, | |||
|
12 | "cells": [ | |||
|
13 | { | |||
|
14 | "cell_type": "heading", | |||
|
15 | "level": 1, | |||
|
16 | "metadata": {}, | |||
|
17 | "source": [ | |||
|
18 | "nbconvert latex test" | |||
|
19 | ] | |||
|
20 | }, | |||
|
21 | { | |||
|
22 | "cell_type": "markdown", | |||
|
23 | "metadata": {}, | |||
|
24 | "source": [ | |||
|
25 | "**Lorem ipsum** dolor sit amet, consectetur adipiscing elit. Nunc luctus bibendum felis dictum sodales. Ut suscipit, orci ut interdum imperdiet, purus ligula mollis *justo*, non malesuada nisl augue eget lorem. Donec bibendum, erat sit amet porttitor aliquam, urna lorem ornare libero, in vehicula diam diam ut ante. Nam non urna rhoncus, accumsan elit sit amet, mollis tellus. Vestibulum nec tellus metus. Vestibulum tempor, ligula et vehicula rhoncus, sapien turpis faucibus lorem, id dapibus turpis mauris ac orci. Sed volutpat vestibulum venenatis." | |||
|
26 | ] | |||
|
27 | }, | |||
|
28 | { | |||
|
29 | "cell_type": "heading", | |||
|
30 | "level": 2, | |||
|
31 | "metadata": {}, | |||
|
32 | "source": [ | |||
|
33 | "Printed Using Python" | |||
|
34 | ] | |||
|
35 | }, | |||
|
36 | { | |||
|
37 | "cell_type": "code", | |||
|
38 | "source": [ | |||
|
39 | "print(\"hello\")" | |||
|
40 | ], | |||
|
41 | "metadata": { | |||
|
42 | "collapsed": false, | |||
|
43 | "autoscroll": false | |||
|
44 | }, | |||
|
45 | "outputs": [ | |||
|
46 | { | |||
|
47 | "output_type": "stream", | |||
|
48 | "metadata": {}, | |||
|
49 | "name": "stdout", | |||
|
50 | "text": [ | |||
|
51 | "hello\n" | |||
|
52 | ] | |||
|
53 | } | |||
|
54 | ], | |||
|
55 | "prompt_number": 1 | |||
|
56 | }, | |||
|
57 | { | |||
|
58 | "cell_type": "heading", | |||
|
59 | "level": 2, | |||
|
60 | "metadata": {}, | |||
|
61 | "source": [ | |||
|
62 | "Pyout" | |||
|
63 | ] | |||
|
64 | }, | |||
|
65 | { | |||
|
66 | "cell_type": "code", | |||
|
67 | "source": [ | |||
|
68 | "from IPython.display import HTML\n", | |||
|
69 | "HTML(\"\"\"\n", | |||
|
70 | "<script>\n", | |||
|
71 | "console.log(\"hello\");\n", | |||
|
72 | "</script>\n", | |||
|
73 | "<b>HTML</b>\n", | |||
|
74 | "\"\"\")" | |||
|
75 | ], | |||
|
76 | "metadata": { | |||
|
77 | "collapsed": false, | |||
|
78 | "autoscroll": false | |||
|
79 | }, | |||
|
80 | "outputs": [ | |||
|
81 | { | |||
|
82 | "text/html": [ | |||
|
83 | "\n", | |||
|
84 | "<script>\n", | |||
|
85 | "console.log(\"hello\");\n", | |||
|
86 | "</script>\n", | |||
|
87 | "<b>HTML</b>\n" | |||
|
88 | ], | |||
|
89 | "metadata": {}, | |||
|
90 | "output_type": "execute_result", | |||
|
91 | "prompt_number": 3, | |||
|
92 | "text/plain": [ | |||
|
93 | "<IPython.core.display.HTML at 0x1112757d0>" | |||
|
94 | ] | |||
|
95 | } | |||
|
96 | ], | |||
|
97 | "prompt_number": 3 | |||
|
98 | }, | |||
|
99 | { | |||
|
100 | "cell_type": "code", | |||
|
101 | "source": [ | |||
|
102 | "%%javascript\n", | |||
|
103 | "console.log(\"hi\");" | |||
|
104 | ], | |||
|
105 | "metadata": { | |||
|
106 | "collapsed": false, | |||
|
107 | "autoscroll": false | |||
|
108 | }, | |||
|
109 | "outputs": [ | |||
|
110 | { | |||
|
111 | "text/javascript": [ | |||
|
112 | "console.log(\"hi\");" | |||
|
113 | ], | |||
|
114 | "metadata": {}, | |||
|
115 | "output_type": "display_data", | |||
|
116 | "text/plain": [ | |||
|
117 | "<IPython.core.display.Javascript at 0x1112b4b50>" | |||
|
118 | ] | |||
|
119 | } | |||
|
120 | ], | |||
|
121 | "prompt_number": 7 | |||
|
122 | }, | |||
|
123 | { | |||
|
124 | "cell_type": "heading", | |||
|
125 | "level": 3, | |||
|
126 | "metadata": {}, | |||
|
127 | "source": [ | |||
|
128 | "Image" | |||
|
129 | ] | |||
|
130 | }, | |||
|
131 | { | |||
|
132 | "cell_type": "code", | |||
|
133 | "source": [ | |||
|
134 | "from IPython.display import Image\n", | |||
|
135 | "Image(\"http://ipython.org/_static/IPy_header.png\")" | |||
|
136 | ], | |||
|
137 | "metadata": { | |||
|
138 | "collapsed": false, | |||
|
139 | "autoscroll": false | |||
|
140 | }, | |||
|
141 | "outputs": [ | |||
|
142 | { | |||
|
143 | "metadata": {}, | |||
|
144 | "output_type": "execute_result", | |||
|
145 | "image/png": "iVBORw0KGgoAAAANSUhEUgAAAggAAABDCAYAAAD5/P3lAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAH3AAAB9wBYvxo6AAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAACAASURB\nVHic7Z15uBxF1bjfugkJhCWBsCSAJGACNg4QCI3RT1lEAVE+UEBNOmwCDcjHT1wQgU+WD3dFxA1o\nCAikAZFFVlnCjizpsCUjHQjBIAkQlpCFJGS79fvjdGf69vTsc2fuza33eeaZmeqq6jM9vZw6dc4p\nBUwC+tE+fqW1fqmRDpRSHjCggS40sBxYDCxKvL8KzNBaL21EPoPB0DPIWVY/4NlE0ffzYfhgu+Qx\nGHoy/YFjaK+CcB3QkIIAHAWs3wRZsuhUSs0CXgQeBm7UWi/spn0Z+jA5yxpEfYruqnwYllRic5a1\nMaWv8U5gaT4M19Sx396IAnZLfB/SLkEMhp5O/3YL0AvoAHaKXl8HLlZK3QZcpbWe0lbJDOsaHuDU\n0e4u4JAy2wPk/C1JzrKWArOQ0fUtwH35MOysQxaDwbCO0NFuAX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DAYDH2DePo5MwrJ\ndv0hFPwTnjBRDAaDwWAw9A3+hPgOHRPl25iK+FhsiuR4OARx0Lwf+J1REAwGg8Fg6AMEnvNklL78\nHMRRca/E5hVINNIVwI2B56z6/3ExLRI31pXNAAAAAElFTkSuQmCC\n", | |||
|
146 | "prompt_number": 6, | |||
|
147 | "text/plain": [ | |||
|
148 | "<IPython.core.display.Image at 0x111275490>" | |||
|
149 | ] | |||
|
150 | } | |||
|
151 | ], | |||
|
152 | "prompt_number": 6 | |||
|
153 | } | |||
|
154 | ] | |||
|
155 | } |
@@ -1,26 +1,10 | |||||
1 | """API for converting notebooks between versions. |
|
1 | """API for converting notebooks between versions.""" | |
2 |
|
2 | |||
3 | Authors: |
|
3 | # Copyright (c) IPython Development Team. | |
4 |
|
4 | # Distributed under the terms of the Modified BSD License. | ||
5 | * Jonathan Frederic |
|
|||
6 | """ |
|
|||
7 |
|
||||
8 | #----------------------------------------------------------------------------- |
|
|||
9 | # Copyright (C) 2013 The IPython Development Team |
|
|||
10 | # |
|
|||
11 | # Distributed under the terms of the BSD License. The full license is in |
|
|||
12 | # the file COPYING, distributed as part of this software. |
|
|||
13 | #----------------------------------------------------------------------------- |
|
|||
14 |
|
||||
15 | #----------------------------------------------------------------------------- |
|
|||
16 | # Imports |
|
|||
17 | #----------------------------------------------------------------------------- |
|
|||
18 |
|
5 | |||
19 | from .reader import get_version, versions |
|
6 | from .reader import get_version, versions | |
20 |
|
7 | |||
21 | #----------------------------------------------------------------------------- |
|
|||
22 | # Functions |
|
|||
23 | #----------------------------------------------------------------------------- |
|
|||
24 |
|
8 | |||
25 | def convert(nb, to_version): |
|
9 | def convert(nb, to_version): | |
26 | """Convert a notebook node object to a specific version. Assumes that |
|
10 | """Convert a notebook node object to a specific version. Assumes that | |
@@ -60,11 +44,11 def convert(nb, to_version): | |||||
60 | # Convert and make sure version changed during conversion. |
|
44 | # Convert and make sure version changed during conversion. | |
61 | converted = convert_function(nb) |
|
45 | converted = convert_function(nb) | |
62 | if converted.get('nbformat', 1) == version: |
|
46 | if converted.get('nbformat', 1) == version: | |
63 |
raise |
|
47 | raise ValueError("Cannot convert notebook from v%d to v%d. Operation" \ | |
64 | "failed silently." % (version, step_version)) |
|
48 | "failed silently." % (version, step_version)) | |
65 |
|
49 | |||
66 | # Recursively convert until target version is reached. |
|
50 | # Recursively convert until target version is reached. | |
67 | return convert(converted, to_version) |
|
51 | return convert(converted, to_version) | |
68 | else: |
|
52 | else: | |
69 |
raise |
|
53 | raise ValueError("Cannot convert notebook to v%d because that " \ | |
70 | "version doesn't exist" % (to_version)) |
|
54 | "version doesn't exist" % (to_version)) |
@@ -1,36 +1,22 | |||||
1 |
"""API for reading notebooks |
|
1 | """API for reading notebooks of different versions""" | |
2 |
|
2 | |||
3 | Authors: |
|
3 | # Copyright (c) IPython Development Team. | |
4 |
|
4 | # Distributed under the terms of the Modified BSD License. | ||
5 | * Jonathan Frederic |
|
|||
6 | """ |
|
|||
7 |
|
||||
8 | #----------------------------------------------------------------------------- |
|
|||
9 | # Copyright (C) 2013 The IPython Development Team |
|
|||
10 | # |
|
|||
11 | # Distributed under the terms of the BSD License. The full license is in |
|
|||
12 | # the file COPYING, distributed as part of this software. |
|
|||
13 | #----------------------------------------------------------------------------- |
|
|||
14 |
|
||||
15 | #----------------------------------------------------------------------------- |
|
|||
16 | # Imports |
|
|||
17 | #----------------------------------------------------------------------------- |
|
|||
18 |
|
5 | |||
19 | import json |
|
6 | import json | |
20 |
|
7 | |||
21 | from . import v1 |
|
8 | from . import v1 | |
22 | from . import v2 |
|
9 | from . import v2 | |
23 | from . import v3 |
|
10 | from . import v3 | |
|
11 | from . import v4 | |||
24 |
|
12 | |||
25 | versions = { |
|
13 | versions = { | |
26 | 1: v1, |
|
14 | 1: v1, | |
27 | 2: v2, |
|
15 | 2: v2, | |
28 | 3: v3, |
|
16 | 3: v3, | |
|
17 | 4: v4, | |||
29 | } |
|
18 | } | |
30 |
|
19 | |||
31 | #----------------------------------------------------------------------------- |
|
|||
32 | # Code |
|
|||
33 | #----------------------------------------------------------------------------- |
|
|||
34 |
|
20 | |||
35 | class NotJSONError(ValueError): |
|
21 | class NotJSONError(ValueError): | |
36 | pass |
|
22 | pass |
@@ -17,7 +17,6 from IPython.core.application import BaseIPythonApplication, base_flags | |||||
17 |
|
17 | |||
18 | from .current import read, write |
|
18 | from .current import read, write | |
19 |
|
19 | |||
20 |
|
||||
21 | try: |
|
20 | try: | |
22 | # Python 3 |
|
21 | # Python 3 | |
23 | algorithms = hashlib.algorithms_guaranteed |
|
22 | algorithms = hashlib.algorithms_guaranteed | |
@@ -181,10 +180,10 class NotebookNotary(LoggingConfigurable): | |||||
181 |
|
180 | |||
182 | This function is the inverse of check_cells |
|
181 | This function is the inverse of check_cells | |
183 | """ |
|
182 | """ | |
184 |
if not nb[' |
|
183 | if not nb['cells']: | |
185 | # nothing to mark if there are no cells |
|
184 | # nothing to mark if there are no cells | |
186 | return |
|
185 | return | |
187 |
for cell in nb[' |
|
186 | for cell in nb['cells']: | |
188 | if cell['cell_type'] == 'code': |
|
187 | if cell['cell_type'] == 'code': | |
189 | cell['metadata']['trusted'] = trusted |
|
188 | cell['metadata']['trusted'] = trusted | |
190 |
|
189 | |||
@@ -206,12 +205,11 class NotebookNotary(LoggingConfigurable): | |||||
206 | # explicitly safe output |
|
205 | # explicitly safe output | |
207 | safe = { |
|
206 | safe = { | |
208 | 'text/plain', 'image/png', 'image/jpeg', |
|
207 | 'text/plain', 'image/png', 'image/jpeg', | |
209 | 'text', 'png', 'jpg', # v3-style short keys |
|
|||
210 | } |
|
208 | } | |
211 |
|
209 | |||
212 | for output in cell['outputs']: |
|
210 | for output in cell['outputs']: | |
213 | output_type = output['output_type'] |
|
211 | output_type = output['output_type'] | |
214 |
if output_type in |
|
212 | if output_type in {'execute_result', 'display_data'}: | |
215 | # if there are any data keys not in the safe whitelist |
|
213 | # if there are any data keys not in the safe whitelist | |
216 | output_keys = set(output).difference({"output_type", "prompt_number", "metadata"}) |
|
214 | output_keys = set(output).difference({"output_type", "prompt_number", "metadata"}) | |
217 | if output_keys.difference(safe): |
|
215 | if output_keys.difference(safe): | |
@@ -226,10 +224,10 class NotebookNotary(LoggingConfigurable): | |||||
226 |
|
224 | |||
227 | This function is the inverse of mark_cells. |
|
225 | This function is the inverse of mark_cells. | |
228 | """ |
|
226 | """ | |
229 |
if not nb[' |
|
227 | if not nb['cells']: | |
230 | return True |
|
228 | return True | |
231 | trusted = True |
|
229 | trusted = True | |
232 |
for cell in nb[' |
|
230 | for cell in nb['cells']: | |
233 | if cell['cell_type'] != 'code': |
|
231 | if cell['cell_type'] != 'code': | |
234 | continue |
|
232 | continue | |
235 | # only distrust a cell if it actually has some output to distrust |
|
233 | # only distrust a cell if it actually has some output to distrust |
@@ -1,16 +1,7 | |||||
1 | """ |
|
1 | """Tests for nbformat.convert""" | |
2 | Contains tests class for convert.py |
|
2 | ||
3 | """ |
|
3 | # Copyright (c) IPython Development Team. | |
4 | #----------------------------------------------------------------------------- |
|
4 | # Distributed under the terms of the Modified BSD License. | |
5 | # Copyright (C) 2013 The IPython Development Team |
|
|||
6 | # |
|
|||
7 | # Distributed under the terms of the BSD License. The full license is in |
|
|||
8 | # the file COPYING, distributed as part of this software. |
|
|||
9 | #----------------------------------------------------------------------------- |
|
|||
10 |
|
||||
11 | #----------------------------------------------------------------------------- |
|
|||
12 | # Imports |
|
|||
13 | #----------------------------------------------------------------------------- |
|
|||
14 |
|
5 | |||
15 | from .base import TestsBase |
|
6 | from .base import TestsBase | |
16 |
|
7 | |||
@@ -18,13 +9,10 from ..convert import convert | |||||
18 | from ..reader import read, get_version |
|
9 | from ..reader import read, get_version | |
19 | from ..current import current_nbformat |
|
10 | from ..current import current_nbformat | |
20 |
|
11 | |||
21 | #----------------------------------------------------------------------------- |
|
|||
22 | # Classes and functions |
|
|||
23 | #----------------------------------------------------------------------------- |
|
|||
24 |
|
12 | |||
25 | class TestConvert(TestsBase): |
|
13 | class TestConvert(TestsBase): | |
26 |
|
14 | |||
27 | def test_downgrade(self): |
|
15 | def test_downgrade_3_2(self): | |
28 | """Do notebook downgrades work?""" |
|
16 | """Do notebook downgrades work?""" | |
29 |
|
17 | |||
30 | # Open a version 3 notebook and attempt to downgrade it to version 2. |
|
18 | # Open a version 3 notebook and attempt to downgrade it to version 2. | |
@@ -37,7 +25,7 class TestConvert(TestsBase): | |||||
37 | self.assertEqual(major, 2) |
|
25 | self.assertEqual(major, 2) | |
38 |
|
26 | |||
39 |
|
27 | |||
40 | def test_upgrade(self): |
|
28 | def test_upgrade_2_3(self): | |
41 | """Do notebook upgrades work?""" |
|
29 | """Do notebook upgrades work?""" | |
42 |
|
30 | |||
43 | # Open a version 2 notebook and attempt to upgrade it to version 3. |
|
31 | # Open a version 2 notebook and attempt to upgrade it to version 3. |
@@ -1,14 +1,7 | |||||
1 | """Test Notebook signing""" |
|
1 | """Test Notebook signing""" | |
2 | #----------------------------------------------------------------------------- |
|
|||
3 | # Copyright (C) 2014, The IPython Development Team |
|
|||
4 | # |
|
|||
5 | # Distributed under the terms of the BSD License. The full license is in |
|
|||
6 | # the file COPYING, distributed as part of this software. |
|
|||
7 | #----------------------------------------------------------------------------- |
|
|||
8 |
|
2 | |||
9 | #----------------------------------------------------------------------------- |
|
3 | # Copyright (c) IPython Development Team. | |
10 | # Imports |
|
4 | # Distributed under the terms of the Modified BSD License. | |
11 | #----------------------------------------------------------------------------- |
|
|||
12 |
|
5 | |||
13 | from .. import sign |
|
6 | from .. import sign | |
14 | from .base import TestsBase |
|
7 | from .base import TestsBase | |
@@ -16,9 +9,6 from .base import TestsBase | |||||
16 | from ..current import read |
|
9 | from ..current import read | |
17 | from IPython.core.getipython import get_ipython |
|
10 | from IPython.core.getipython import get_ipython | |
18 |
|
11 | |||
19 | #----------------------------------------------------------------------------- |
|
|||
20 | # Classes and functions |
|
|||
21 | #----------------------------------------------------------------------------- |
|
|||
22 |
|
12 | |||
23 | class TestNotary(TestsBase): |
|
13 | class TestNotary(TestsBase): | |
24 |
|
14 | |||
@@ -80,7 +70,7 class TestNotary(TestsBase): | |||||
80 | self.assertTrue(check_signature(nb)) |
|
70 | self.assertTrue(check_signature(nb)) | |
81 |
|
71 | |||
82 | def test_mark_cells_untrusted(self): |
|
72 | def test_mark_cells_untrusted(self): | |
83 |
cells = self.nb. |
|
73 | cells = self.nb.cells | |
84 | self.notary.mark_cells(self.nb, False) |
|
74 | self.notary.mark_cells(self.nb, False) | |
85 | for cell in cells: |
|
75 | for cell in cells: | |
86 | self.assertNotIn('trusted', cell) |
|
76 | self.assertNotIn('trusted', cell) | |
@@ -91,7 +81,7 class TestNotary(TestsBase): | |||||
91 | self.assertNotIn('trusted', cell.metadata) |
|
81 | self.assertNotIn('trusted', cell.metadata) | |
92 |
|
82 | |||
93 | def test_mark_cells_trusted(self): |
|
83 | def test_mark_cells_trusted(self): | |
94 |
cells = self.nb. |
|
84 | cells = self.nb.cells | |
95 | self.notary.mark_cells(self.nb, True) |
|
85 | self.notary.mark_cells(self.nb, True) | |
96 | for cell in cells: |
|
86 | for cell in cells: | |
97 | self.assertNotIn('trusted', cell) |
|
87 | self.assertNotIn('trusted', cell) | |
@@ -105,17 +95,17 class TestNotary(TestsBase): | |||||
105 | nb = self.nb |
|
95 | nb = self.nb | |
106 | self.notary.mark_cells(nb, True) |
|
96 | self.notary.mark_cells(nb, True) | |
107 | self.assertTrue(self.notary.check_cells(nb)) |
|
97 | self.assertTrue(self.notary.check_cells(nb)) | |
108 |
for cell in nb. |
|
98 | for cell in nb.cells: | |
109 | self.assertNotIn('trusted', cell) |
|
99 | self.assertNotIn('trusted', cell) | |
110 | self.notary.mark_cells(nb, False) |
|
100 | self.notary.mark_cells(nb, False) | |
111 | self.assertFalse(self.notary.check_cells(nb)) |
|
101 | self.assertFalse(self.notary.check_cells(nb)) | |
112 |
for cell in nb. |
|
102 | for cell in nb.cells: | |
113 | self.assertNotIn('trusted', cell) |
|
103 | self.assertNotIn('trusted', cell) | |
114 |
|
104 | |||
115 | def test_trust_no_output(self): |
|
105 | def test_trust_no_output(self): | |
116 | nb = self.nb |
|
106 | nb = self.nb | |
117 | self.notary.mark_cells(nb, False) |
|
107 | self.notary.mark_cells(nb, False) | |
118 |
for cell in nb. |
|
108 | for cell in nb.cells: | |
119 | if cell.cell_type == 'code': |
|
109 | if cell.cell_type == 'code': | |
120 | cell.outputs = [] |
|
110 | cell.outputs = [] | |
121 | self.assertTrue(self.notary.check_cells(nb)) |
|
111 | self.assertTrue(self.notary.check_cells(nb)) |
@@ -11,14 +11,10 from ..current import read | |||||
11 | from ..validator import isvalid, validate |
|
11 | from ..validator import isvalid, validate | |
12 |
|
12 | |||
13 |
|
13 | |||
14 | #----------------------------------------------------------------------------- |
|
|||
15 | # Classes and functions |
|
|||
16 | #----------------------------------------------------------------------------- |
|
|||
17 |
|
||||
18 | class TestValidator(TestsBase): |
|
14 | class TestValidator(TestsBase): | |
19 |
|
15 | |||
20 | def test_nb2(self): |
|
16 | def test_nb2(self): | |
21 |
"""Test that a v2 notebook converted to |
|
17 | """Test that a v2 notebook converted to current passes validation""" | |
22 | with self.fopen(u'test2.ipynb', u'r') as f: |
|
18 | with self.fopen(u'test2.ipynb', u'r') as f: | |
23 | nb = read(f, u'json') |
|
19 | nb = read(f, u'json') | |
24 | validate(nb) |
|
20 | validate(nb) | |
@@ -31,6 +27,13 class TestValidator(TestsBase): | |||||
31 | validate(nb) |
|
27 | validate(nb) | |
32 | self.assertEqual(isvalid(nb), True) |
|
28 | self.assertEqual(isvalid(nb), True) | |
33 |
|
29 | |||
|
30 | def test_nb4(self): | |||
|
31 | """Test that a v3 notebook passes validation""" | |||
|
32 | with self.fopen(u'test4.ipynb', u'r') as f: | |||
|
33 | nb = read(f, u'json') | |||
|
34 | validate(nb) | |||
|
35 | self.assertEqual(isvalid(nb), True) | |||
|
36 | ||||
34 | def test_invalid(self): |
|
37 | def test_invalid(self): | |
35 | """Test than an invalid notebook does not pass validation""" |
|
38 | """Test than an invalid notebook does not pass validation""" | |
36 | # this notebook has a few different errors: |
|
39 | # this notebook has a few different errors: |
@@ -4,7 +4,7 | |||||
4 | # Distributed under the terms of the Modified BSD License. |
|
4 | # Distributed under the terms of the Modified BSD License. | |
5 |
|
5 | |||
6 | from .nbbase import ( |
|
6 | from .nbbase import ( | |
7 | NotebookNode, |
|
7 | NotebookNode, from_dict, | |
8 | nbformat, nbformat_minor, nbformat_schema, |
|
8 | nbformat, nbformat_minor, nbformat_schema, | |
9 | new_code_cell, new_heading_cell, new_markdown_cell, new_notebook, |
|
9 | new_code_cell, new_heading_cell, new_markdown_cell, new_notebook, | |
10 | new_output, |
|
10 | new_output, |
General Comments 0
You need to be logged in to leave comments.
Login now