Show More
@@ -17,7 +17,7 b' mime = {' | |||||
17 |
|
17 | |||
18 | var black_dot_jpeg="\"\"\"/9j/4AAQSkZJRgABAQEASABIAAD/2wBDACodICUgGiolIiUvLSoyP2lEPzo6P4FcYUxpmYagnpaG\nk5GovfLNqLPltZGT0v/V5fr/////o8v///////L/////2wBDAS0vLz83P3xERHz/rpOu////////\n////////////////////////////////////////////////////////////wgARCAABAAEDAREA\nAhEBAxEB/8QAFAABAAAAAAAAAAAAAAAAAAAABP/EABQBAQAAAAAAAAAAAAAAAAAAAAD/2gAMAwEA\nAhADEAAAARn/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/9oACAEBAAEFAn//xAAUEQEAAAAAAAAAAAAA\nAAAAAAAA/9oACAEDAQE/AX//xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oACAECAQE/AX//xAAUEAEA\nAAAAAAAAAAAAAAAAAAAA/9oACAEBAAY/An//xAAUEAEAAAAAAAAAAAAAAAAAAAAA/9oACAEBAAE/\nIX//2gAMAwEAAgADAAAAEB//xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oACAEDAQE/EH//xAAUEQEA\nAAAAAAAAAAAAAAAAAAAA/9oACAECAQE/EH//xAAUEAEAAAAAAAAAAAAAAAAAAAAA/9oACAEBAAE/\nEH//2Q==\"\"\""; |
|
18 | var black_dot_jpeg="\"\"\"/9j/4AAQSkZJRgABAQEASABIAAD/2wBDACodICUgGiolIiUvLSoyP2lEPzo6P4FcYUxpmYagnpaG\nk5GovfLNqLPltZGT0v/V5fr/////o8v///////L/////2wBDAS0vLz83P3xERHz/rpOu////////\n////////////////////////////////////////////////////////////wgARCAABAAEDAREA\nAhEBAxEB/8QAFAABAAAAAAAAAAAAAAAAAAAABP/EABQBAQAAAAAAAAAAAAAAAAAAAAD/2gAMAwEA\nAhADEAAAARn/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/9oACAEBAAEFAn//xAAUEQEAAAAAAAAAAAAA\nAAAAAAAA/9oACAEDAQE/AX//xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oACAECAQE/AX//xAAUEAEA\nAAAAAAAAAAAAAAAAAAAA/9oACAEBAAY/An//xAAUEAEAAAAAAAAAAAAAAAAAAAAA/9oACAEBAAE/\nIX//2gAMAwEAAgADAAAAEB//xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oACAEDAQE/EH//xAAUEQEA\nAAAAAAAAAAAAAAAAAAAA/9oACAECAQE/EH//xAAUEAEAAAAAAAAAAAAAAAAAAAAA/9oACAEBAAE/\nEH//2Q==\"\"\""; | |
19 | var black_dot_png = '\"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAWJLR0QA\\niAUdSAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB94BCRQnOqNu0b4AAAAKSURBVAjXY2AA\\nAAACAAHiIbwzAAAAAElFTkSuQmCC\"'; |
|
19 | var black_dot_png = '\"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAWJLR0QA\\niAUdSAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB94BCRQnOqNu0b4AAAAKSURBVAjXY2AA\\nAAACAAHiIbwzAAAAAElFTkSuQmCC\"'; | |
20 | var svg = "\"<svg width='1cm' height='1cm' viewBox='0 0 1000 500'><defs><style>rect {fill:red;}; </style></defs><rect id='r1' x='200' y='100' width='600' height='300' /></svg>\"" |
|
20 | var svg = "\"<svg width='1cm' height='1cm' viewBox='0 0 1000 500'><defs><style>rect {fill:red;}; </style></defs><rect id='r1' x='200' y='100' width='600' height='300' /></svg>\""; | |
21 |
|
21 | |||
22 |
|
|
22 | // helper function to ensure that the short_name is found in the toJSON | |
23 | // represetnation, while the original in-memory cell retains its long mimetype |
|
23 | // represetnation, while the original in-memory cell retains its long mimetype | |
@@ -207,5 +207,29 b' casper.notebook_test(function () {' | |||||
207 | }); |
|
207 | }); | |
208 |
|
208 | |||
209 | this.thenEvaluate(function() { IPython.notebook.save_notebook(); }); |
|
209 | this.thenEvaluate(function() { IPython.notebook.save_notebook(); }); | |
210 |
|
210 | |||
|
211 | this.then(function() { | |||
|
212 | clear_and_execute(this, [ | |||
|
213 | "from IPython.core.formatters import HTMLFormatter", | |||
|
214 | "x = HTMLFormatter()", | |||
|
215 | "x.format_type = 'text/superfancymimetype'", | |||
|
216 | "get_ipython().display_formatter.formatters['text/superfancymimetype'] = x", | |||
|
217 | "from IPython.display import HTML, display", | |||
|
218 | 'display(HTML("yo"))', | |||
|
219 | "HTML('hello')"].join('\n') | |||
|
220 | ); | |||
|
221 | ||||
|
222 | }); | |||
|
223 | ||||
|
224 | this.then(function ( ) { | |||
|
225 | var long_name = 'text/superfancymimetype'; | |||
|
226 | var result = this.get_output_cell(0); | |||
|
227 | this.test.assertTrue(result.hasOwnProperty(long_name), | |||
|
228 | 'display_data custom mimetype ' + long_name); | |||
|
229 | var result = this.get_output_cell(0, 1); | |||
|
230 | this.test.assertTrue(result.hasOwnProperty(long_name), | |||
|
231 | 'pyout custom mimetype ' + long_name); | |||
|
232 | ||||
|
233 | }); | |||
|
234 | ||||
211 | }); |
|
235 | }); |
@@ -76,12 +76,13 b' casper.wait_for_output = function (cell_num) {' | |||||
76 | }; |
|
76 | }; | |
77 |
|
77 | |||
78 | // return the output of a given cell |
|
78 | // return the output of a given cell | |
79 | casper.get_output_cell = function (cell_num) { |
|
79 | casper.get_output_cell = function (cell_num, out_num) { | |
80 | var result = casper.evaluate(function (c) { |
|
80 | out_num = out_num || 0; | |
|
81 | var result = casper.evaluate(function (c, o) { | |||
81 | var cell = IPython.notebook.get_cell(c); |
|
82 | var cell = IPython.notebook.get_cell(c); | |
82 |
return cell.output_area.outputs[ |
|
83 | return cell.output_area.outputs[o]; | |
83 | }, |
|
84 | }, | |
84 | {c : cell_num}); |
|
85 | {c : cell_num, o : out_num}); | |
85 | return result; |
|
86 | return result; | |
86 | }; |
|
87 | }; | |
87 |
|
88 |
General Comments 0
You need to be logged in to leave comments.
Login now