Show More
@@ -1,177 +1,186 b'' | |||||
1 | { |
|
1 | { | |
2 | "metadata": { |
|
2 | "metadata": { | |
3 | "name": "notebook2" |
|
3 | "name": "notebook2" | |
4 | }, |
|
4 | }, | |
5 | "nbformat": 3, |
|
5 | "nbformat": 3, | |
6 | "nbformat_minor": 0, |
|
6 | "nbformat_minor": 0, | |
7 | "worksheets": [ |
|
7 | "worksheets": [ | |
8 | { |
|
8 | { | |
9 | "cells": [ |
|
9 | "cells": [ | |
10 | { |
|
10 | { | |
11 | "cell_type": "heading", |
|
11 | "cell_type": "heading", | |
12 | "level": 1, |
|
12 | "level": 1, | |
13 | "metadata": {}, |
|
13 | "metadata": {}, | |
14 | "source": [ |
|
14 | "source": [ | |
15 | "NumPy and Matplotlib examples" |
|
15 | "NumPy and Matplotlib examples" | |
16 | ] |
|
16 | ] | |
17 | }, |
|
17 | }, | |
18 | { |
|
18 | { | |
19 | "cell_type": "markdown", |
|
19 | "cell_type": "markdown", | |
20 | "metadata": {}, |
|
20 | "metadata": {}, | |
21 | "source": [ |
|
21 | "source": [ | |
22 | "First import NumPy and Matplotlib:" |
|
22 | "First import NumPy and Matplotlib:" | |
23 | ] |
|
23 | ] | |
24 | }, |
|
24 | }, | |
25 | { |
|
25 | { | |
26 | "cell_type": "code", |
|
26 | "cell_type": "code", | |
27 | "collapsed": false, |
|
27 | "collapsed": false, | |
28 | "input": [ |
|
28 | "input": [ | |
29 | "%pylab inline" |
|
29 | "%pylab inline" | |
30 | ], |
|
30 | ], | |
31 | "language": "python", |
|
31 | "language": "python", | |
32 | "metadata": {}, |
|
32 | "metadata": {}, | |
33 | "outputs": [ |
|
33 | "outputs": [ | |
34 | { |
|
34 | { | |
35 | "output_type": "stream", |
|
35 | "output_type": "stream", | |
36 | "stream": "stdout", |
|
36 | "stream": "stdout", | |
37 | "text": [ |
|
37 | "text": [ | |
38 | "\n", |
|
38 | "\n", | |
39 | "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.kernel.zmq.pylab.backend_inline].\n", |
|
39 | "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.kernel.zmq.pylab.backend_inline].\n", | |
40 | "For more information, type 'help(pylab)'.\n" |
|
40 | "For more information, type 'help(pylab)'.\n" | |
41 | ] |
|
41 | ] | |
42 | } |
|
42 | } | |
43 | ], |
|
43 | ], | |
44 | "prompt_number": 1 |
|
44 | "prompt_number": 1 | |
45 | }, |
|
45 | }, | |
46 | { |
|
46 | { | |
47 | "cell_type": "code", |
|
47 | "cell_type": "code", | |
48 | "collapsed": false, |
|
48 | "collapsed": false, | |
49 | "input": [ |
|
49 | "input": [ | |
50 | "import numpy as np" |
|
50 | "import numpy as np" | |
51 | ], |
|
51 | ], | |
52 | "language": "python", |
|
52 | "language": "python", | |
53 | "metadata": {}, |
|
53 | "metadata": {}, | |
54 | "outputs": [], |
|
54 | "outputs": [], | |
55 | "prompt_number": 2 |
|
55 | "prompt_number": 2 | |
56 | }, |
|
56 | }, | |
57 | { |
|
57 | { | |
58 | "cell_type": "markdown", |
|
58 | "cell_type": "markdown", | |
59 | "metadata": {}, |
|
59 | "metadata": {}, | |
60 | "source": [ |
|
60 | "source": [ | |
61 | "Now we show some very basic examples of how they can be used." |
|
61 | "Now we show some very basic examples of how they can be used." | |
62 | ] |
|
62 | ] | |
63 | }, |
|
63 | }, | |
64 | { |
|
64 | { | |
65 | "cell_type": "code", |
|
65 | "cell_type": "code", | |
66 | "collapsed": false, |
|
66 | "collapsed": false, | |
67 | "input": [ |
|
67 | "input": [ | |
68 | "a = np.random.uniform(size=(100,100))" |
|
68 | "a = np.random.uniform(size=(100,100))" | |
69 | ], |
|
69 | ], | |
70 | "language": "python", |
|
70 | "language": "python", | |
71 | "metadata": {}, |
|
71 | "metadata": {}, | |
72 | "outputs": [], |
|
72 | "outputs": [], | |
73 | "prompt_number": 6 |
|
73 | "prompt_number": 6 | |
74 | }, |
|
74 | }, | |
75 | { |
|
75 | { | |
76 | "cell_type": "code", |
|
76 | "cell_type": "code", | |
77 | "collapsed": false, |
|
77 | "collapsed": false, | |
78 | "input": [ |
|
78 | "input": [ | |
79 | "a.shape" |
|
79 | "a.shape" | |
80 | ], |
|
80 | ], | |
81 | "language": "python", |
|
81 | "language": "python", | |
82 | "metadata": {}, |
|
82 | "metadata": {}, | |
83 | "outputs": [ |
|
83 | "outputs": [ | |
84 | { |
|
84 | { | |
85 | "metadata": {}, |
|
85 | "metadata": {}, | |
86 | "output_type": "pyout", |
|
86 | "output_type": "pyout", | |
87 | "prompt_number": 7, |
|
87 | "prompt_number": 7, | |
88 | "text": [ |
|
88 | "text": [ | |
89 | "(100, 100)" |
|
89 | "(100, 100)" | |
90 | ] |
|
90 | ] | |
91 | } |
|
91 | } | |
92 | ], |
|
92 | ], | |
93 | "prompt_number": 7 |
|
93 | "prompt_number": 7 | |
94 | }, |
|
94 | }, | |
95 | { |
|
95 | { | |
96 | "cell_type": "code", |
|
96 | "cell_type": "code", | |
97 | "collapsed": false, |
|
97 | "collapsed": false, | |
98 | "input": [ |
|
98 | "input": [ | |
99 | "evs = np.linalg.eigvals(a)" |
|
99 | "evs = np.linalg.eigvals(a)" | |
100 | ], |
|
100 | ], | |
101 | "language": "python", |
|
101 | "language": "python", | |
102 | "metadata": {}, |
|
102 | "metadata": {}, | |
103 | "outputs": [], |
|
103 | "outputs": [], | |
104 | "prompt_number": 8 |
|
104 | "prompt_number": 8 | |
105 | }, |
|
105 | }, | |
106 | { |
|
106 | { | |
107 | "cell_type": "code", |
|
107 | "cell_type": "code", | |
108 | "collapsed": false, |
|
108 | "collapsed": false, | |
109 | "input": [ |
|
109 | "input": [ | |
110 | "evs.shape" |
|
110 | "evs.shape" | |
111 | ], |
|
111 | ], | |
112 | "language": "python", |
|
112 | "language": "python", | |
113 | "metadata": {}, |
|
113 | "metadata": {}, | |
114 | "outputs": [ |
|
114 | "outputs": [ | |
115 | { |
|
115 | { | |
116 | "metadata": {}, |
|
116 | "metadata": {}, | |
117 | "output_type": "pyout", |
|
117 | "output_type": "pyout", | |
118 | "prompt_number": 10, |
|
118 | "prompt_number": 10, | |
119 | "text": [ |
|
119 | "text": [ | |
120 | "(100,)" |
|
120 | "(100,)" | |
121 | ] |
|
121 | ] | |
122 | } |
|
122 | } | |
123 | ], |
|
123 | ], | |
124 | "prompt_number": 10 |
|
124 | "prompt_number": 10 | |
125 | }, |
|
125 | }, | |
126 | { |
|
126 | { | |
127 | "cell_type": "markdown", |
|
127 | "cell_type": "markdown", | |
128 | "metadata": {}, |
|
128 | "metadata": {}, | |
129 | "source": [ |
|
129 | "source": [ | |
130 | "Here is a cell that has both text and PNG output:" |
|
130 | "Here is a cell that has both text and PNG output:" | |
131 | ] |
|
131 | ] | |
132 | }, |
|
132 | }, | |
133 | { |
|
133 | { | |
134 | "cell_type": "code", |
|
134 | "cell_type": "code", | |
135 | "collapsed": false, |
|
135 | "collapsed": false, | |
136 | "input": [ |
|
136 | "input": [ | |
137 | "hist(evs.real)" |
|
137 | "hist(evs.real)" | |
138 | ], |
|
138 | ], | |
139 | "language": "python", |
|
139 | "language": "python", | |
140 | "metadata": {}, |
|
140 | "metadata": {}, | |
141 | "outputs": [ |
|
141 | "outputs": [ | |
142 | { |
|
142 | { | |
143 | "metadata": {}, |
|
143 | "metadata": {}, | |
144 | "output_type": "pyout", |
|
144 | "output_type": "pyout", | |
145 | "prompt_number": 14, |
|
145 | "prompt_number": 14, | |
146 | "text": [ |
|
146 | "text": [ | |
147 | "(array([95, 4, 0, 0, 0, 0, 0, 0, 0, 1]),\n", |
|
147 | "(array([95, 4, 0, 0, 0, 0, 0, 0, 0, 1]),\n", | |
148 | " array([ -2.93566063, 2.35937011, 7.65440086, 12.9494316 ,\n", |
|
148 | " array([ -2.93566063, 2.35937011, 7.65440086, 12.9494316 ,\n", | |
149 | " 18.24446235, 23.53949309, 28.83452384, 34.12955458,\n", |
|
149 | " 18.24446235, 23.53949309, 28.83452384, 34.12955458,\n", | |
150 | " 39.42458533, 44.71961607, 50.01464682]),\n", |
|
150 | " 39.42458533, 44.71961607, 50.01464682]),\n", | |
151 | " <a list of 10 Patch objects>)" |
|
151 | " <a list of 10 Patch objects>)" | |
152 | ] |
|
152 | ] | |
153 | }, |
|
153 | }, | |
154 | { |
|
154 | { | |
155 | "metadata": {}, |
|
155 | "metadata": {}, | |
156 | "output_type": "display_data", |
|
156 | "output_type": "display_data", | |
157 | "png": "iVBORw0KGgoAAAANSUhEUgAAAXgAAAD9CAYAAAC2l2x5AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAEhdJREFUeJzt3X1olfX/x/HXtVbT8CZDmsK6KmrubEu3U2xnZOpxLBnG\nOqsIE7RoE3QRZkT/yEAjcIh/LIs6i/BEGSU1CkxT0+pkFp1zMmsxZ5uUTIXoxm95lmdlef3+8Nep\ndbtz7exs16fnAw7sXNs5n/c14nmurl3naDmO4wgAYJy8sR4AADA6CDwAGIrAA4ChCDwAGIrAA4Ch\nCDwAGOofA9/U1KTCwkLNnj07vS2ZTCoUCsm2bTU2NmpgYCD9vccee0zFxcUqKyvTgQMHRm9qAMC/\n+sfA33PPPdq9e/eQbeFwWLZtq6+vT0VFRero6JAkffXVV3ryySf15ptvKhwOa/Xq1aM3NQDgX/1j\n4OfNm6dp06YN2RaPx9Xc3KyCggI1NTUpFotJkmKxmOrr62XbthYsWCDHcZRMJkdvcgDAP8r4HHwi\nkZDP55Mk+Xw+xeNxSecDX1pamv65kpKS9PcAALmXn+kDMvlkA8uyhrUNAPDvMv1kmYyP4KuqqtTT\n0yNJ6unpUVVVlSQpEAjo8OHD6Z87cuRI+nt/NaRXb+vWrRvzGZh/7Odgfu/dvDy747j7yLCMAx8I\nBBSJRJRKpRSJRFRTUyNJqq6u1p49e9Tf369oNKq8vDxNnjzZ1VAAgJH7x8AvXbpUN9xwg3p7e3X5\n5ZfrmWeeUUtLi/r7+1VSUqKTJ09q1apVkqTCwkK1tLSotrZW9957rzZv3pyTHQAA/DXLcXvs73ZB\ny3L9vxvjQT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EXgAMBSBBwBDEXgAMNT/AQKseNIf7mhWAAAAAElFTkSuQmCC\n", | |
158 | "text": [ |
|
158 | "text": [ | |
159 | "<matplotlib.figure.Figure at 0x108c8f1d0>" |
|
159 | "<matplotlib.figure.Figure at 0x108c8f1d0>" | |
160 | ] |
|
160 | ] | |
161 | } |
|
161 | } | |
162 | ], |
|
162 | ], | |
163 | "prompt_number": 14 |
|
163 | "prompt_number": 14 | |
164 | }, |
|
164 | }, | |
165 | { |
|
165 | { | |
166 | "cell_type": "code", |
|
166 | "cell_type": "code", | |
167 | "collapsed": false, |
|
167 | "collapsed": false, | |
168 | "input": [], |
|
168 | "input": [], | |
169 | "language": "python", |
|
169 | "language": "python", | |
170 | "metadata": {}, |
|
170 | "metadata": {}, | |
171 | "outputs": [] |
|
171 | "outputs": [] | |
|
172 | }, | |||
|
173 | { | |||
|
174 | "cell_type": "code", | |||
|
175 | "collapsed": false, | |||
|
176 | "input": [], | |||
|
177 | "language": "python", | |||
|
178 | "metadata": {}, | |||
|
179 | "outputs": [], | |||
|
180 | "prompt_number": null | |||
172 | } |
|
181 | } | |
173 | ], |
|
182 | ], | |
174 | "metadata": {} |
|
183 | "metadata": {} | |
175 | } |
|
184 | } | |
176 | ] |
|
185 | ] | |
177 | } No newline at end of file |
|
186 | } |
@@ -1,61 +1,76 b'' | |||||
1 | """Tests for HTMLExporter""" |
|
1 | """Tests for HTMLExporter""" | |
2 |
|
2 | |||
3 | #----------------------------------------------------------------------------- |
|
3 | #----------------------------------------------------------------------------- | |
4 | # Copyright (c) 2013, the IPython Development Team. |
|
4 | # Copyright (c) 2013, the IPython Development Team. | |
5 | # |
|
5 | # | |
6 | # Distributed under the terms of the Modified BSD License. |
|
6 | # Distributed under the terms of the Modified BSD License. | |
7 | # |
|
7 | # | |
8 | # The full license is in the file COPYING.txt, distributed with this software. |
|
8 | # The full license is in the file COPYING.txt, distributed with this software. | |
9 | #----------------------------------------------------------------------------- |
|
9 | #----------------------------------------------------------------------------- | |
10 |
|
10 | |||
11 | #----------------------------------------------------------------------------- |
|
11 | #----------------------------------------------------------------------------- | |
12 | # Imports |
|
12 | # Imports | |
13 | #----------------------------------------------------------------------------- |
|
13 | #----------------------------------------------------------------------------- | |
14 |
|
14 | |||
15 | from .base import ExportersTestsBase |
|
15 | from .base import ExportersTestsBase | |
16 | from ..html import HTMLExporter |
|
16 | from ..html import HTMLExporter | |
17 | from IPython.testing.decorators import onlyif_any_cmd_exists |
|
17 | from IPython.testing.decorators import onlyif_any_cmd_exists | |
|
18 | import re | |||
18 |
|
19 | |||
19 | #----------------------------------------------------------------------------- |
|
20 | #----------------------------------------------------------------------------- | |
20 | # Class |
|
21 | # Class | |
21 | #----------------------------------------------------------------------------- |
|
22 | #----------------------------------------------------------------------------- | |
22 |
|
23 | |||
23 | class TestHTMLExporter(ExportersTestsBase): |
|
24 | class TestHTMLExporter(ExportersTestsBase): | |
24 | """Tests for HTMLExporter""" |
|
25 | """Tests for HTMLExporter""" | |
25 |
|
26 | |||
26 | exporter_class = HTMLExporter |
|
27 | exporter_class = HTMLExporter | |
27 | should_include_raw = ['html'] |
|
28 | should_include_raw = ['html'] | |
28 |
|
29 | |||
29 | def test_constructor(self): |
|
30 | def test_constructor(self): | |
30 | """ |
|
31 | """ | |
31 | Can a HTMLExporter be constructed? |
|
32 | Can a HTMLExporter be constructed? | |
32 | """ |
|
33 | """ | |
33 | HTMLExporter() |
|
34 | HTMLExporter() | |
34 |
|
35 | |||
35 |
|
36 | |||
36 | @onlyif_any_cmd_exists('nodejs', 'node', 'pandoc') |
|
37 | @onlyif_any_cmd_exists('nodejs', 'node', 'pandoc') | |
37 | def test_export(self): |
|
38 | def test_export(self): | |
38 | """ |
|
39 | """ | |
39 | Can a HTMLExporter export something? |
|
40 | Can a HTMLExporter export something? | |
40 | """ |
|
41 | """ | |
41 | (output, resources) = HTMLExporter().from_filename(self._get_notebook()) |
|
42 | (output, resources) = HTMLExporter().from_filename(self._get_notebook()) | |
42 | assert len(output) > 0 |
|
43 | assert len(output) > 0 | |
43 |
|
44 | |||
44 |
|
45 | |||
45 | @onlyif_any_cmd_exists('nodejs', 'node', 'pandoc') |
|
46 | @onlyif_any_cmd_exists('nodejs', 'node', 'pandoc') | |
46 | def test_export_basic(self): |
|
47 | def test_export_basic(self): | |
47 | """ |
|
48 | """ | |
48 | Can a HTMLExporter export using the 'basic' template? |
|
49 | Can a HTMLExporter export using the 'basic' template? | |
49 | """ |
|
50 | """ | |
50 | (output, resources) = HTMLExporter(template_file='basic').from_filename(self._get_notebook()) |
|
51 | (output, resources) = HTMLExporter(template_file='basic').from_filename(self._get_notebook()) | |
51 | assert len(output) > 0 |
|
52 | assert len(output) > 0 | |
52 |
|
53 | |||
53 |
|
54 | |||
54 | @onlyif_any_cmd_exists('nodejs', 'node', 'pandoc') |
|
55 | @onlyif_any_cmd_exists('nodejs', 'node', 'pandoc') | |
55 | def test_export_full(self): |
|
56 | def test_export_full(self): | |
56 | """ |
|
57 | """ | |
57 | Can a HTMLExporter export using the 'full' template? |
|
58 | Can a HTMLExporter export using the 'full' template? | |
58 | """ |
|
59 | """ | |
59 | (output, resources) = HTMLExporter(template_file='full').from_filename(self._get_notebook()) |
|
60 | (output, resources) = HTMLExporter(template_file='full').from_filename(self._get_notebook()) | |
60 | assert len(output) > 0 |
|
61 | assert len(output) > 0 | |
61 |
|
62 | |||
|
63 | @onlyif_any_cmd_exists('nodejs', 'node', 'pandoc') | |||
|
64 | def test_prompt_number(self): | |||
|
65 | """ | |||
|
66 | Does HTMLExporter properly format input and output prompts? | |||
|
67 | """ | |||
|
68 | (output, resources) = HTMLExporter(template_file='full').from_filename(self._get_notebook()) | |||
|
69 | in_regex = r"In \[(.*)\]:" | |||
|
70 | out_regex = r"Out\[(.*)\]:" | |||
|
71 | ||||
|
72 | ins = ["1", "2", "6", "7", "8", "10", "14", " ", " "] | |||
|
73 | outs = ["7", "10", "14"] | |||
|
74 | ||||
|
75 | assert re.findall(in_regex, output) == ins | |||
|
76 | assert re.findall(out_regex, output) == outs |
General Comments 0
You need to be logged in to leave comments.
Login now