Merge pull request #4536 from minrk/msgspec5

Updating the message spec (finish IPEP 13, 24)
Thomas Kluyver 12 years ago
commit 2cc7b1ca30

@ -1,13 +1,10 @@
//----------------------------------------------------------------------------
// Copyright (C) 2008-2012 The IPython Development Team
//
// Distributed under the terms of the BSD License. The full license is in
// the file COPYING, distributed as part of this software.
//----------------------------------------------------------------------------
// Copyright (c) IPython Development Team.
// Distributed under the terms of the Modified BSD License.
//============================================================================
// Utilities
//============================================================================
IPython.namespace('IPython.utils');
IPython.utils = (function (IPython) {
@ -430,7 +427,7 @@ IPython.utils = (function (IPython) {
var escape_html = function (text) {
// escape text to HTML
return $("<div/>").text(text).html();
}
};
var get_body_data = function(key) {
@ -439,8 +436,40 @@ IPython.utils = (function (IPython) {
// until we are building an actual request
return decodeURIComponent($('body').data(key));
};
var to_absolute_cursor_pos = function (cm, cursor) {
// get the absolute cursor position from CodeMirror's col, ch
if (!cursor) {
cursor = cm.getCursor();
}
var cursor_pos = cursor.ch;
for (var i = 0; i < cursor.line; i++) {
cursor_pos += cm.getLine(i).length + 1;
}
return cursor_pos;
};
var from_absolute_cursor_pos = function (cm, cursor_pos) {
// turn absolute cursor postion into CodeMirror col, ch cursor
var i, line;
var offset = 0;
for (i = 0, line=cm.getLine(i); line !== undefined; i++, line=cm.getLine(i)) {
if (offset + line.length < cursor_pos) {
offset += line.length + 1;
} else {
return {
line : i,
ch : cursor_pos - offset,
};
}
}
// reached end, return endpoint
return {
ch : line.length - 1,
line : i - 1,
};
};
// http://stackoverflow.com/questions/2400935/browser-detection-in-javascript
var browser = (function() {
if (typeof navigator === 'undefined') {
@ -449,7 +478,7 @@ IPython.utils = (function (IPython) {
}
var N= navigator.appName, ua= navigator.userAgent, tem;
var M= ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
if (M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1];
if (M && (tem= ua.match(/version\/([\.\d]+)/i)) !== null) M[2]= tem[1];
M= M? [M[1], M[2]]: [N, navigator.appVersion,'-?'];
return M;
})();
@ -465,13 +494,13 @@ IPython.utils = (function (IPython) {
if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";
if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";
if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";
return OSName
return OSName;
})();
var is_or_has = function (a, b) {
// Is b a child of a or a itself?
return a.has(b).length !==0 || a.is(b);
}
};
var is_focused = function (e) {
// Is element e, or one of its children focused?
@ -486,7 +515,7 @@ IPython.utils = (function (IPython) {
} else {
return false;
}
}
};
var log_ajax_error = function (jqXHR, status, error) {
// log ajax failures with informative messages
@ -499,7 +528,7 @@ IPython.utils = (function (IPython) {
}
console.log(msg);
};
return {
regex_split : regex_split,
uuid : uuid,
@ -515,6 +544,8 @@ IPython.utils = (function (IPython) {
splitext : splitext,
escape_html : escape_html,
always_new : always_new,
to_absolute_cursor_pos : to_absolute_cursor_pos,
from_absolute_cursor_pos : from_absolute_cursor_pos,
browser : browser,
platform: platform,
is_or_has : is_or_has,

@ -1,21 +1,26 @@
// function completer.
// Copyright (c) IPython Development Team.
// Distributed under the terms of the Modified BSD License.
// Completer
//
// completer should be a class that takes an cell instance
// Completer is be a class that takes a cell instance.
var IPython = (function (IPython) {
// that will prevent us from misspelling
"use strict";
// easier key mapping
var keycodes = IPython.keyboard.keycodes;
var utils = IPython.utils;
function prepend_n_prc(str, n) {
var prepend_n_prc = function(str, n) {
for( var i =0 ; i< n ; i++){
str = '%'+str ;
}
return str;
};
function _existing_completion(item, completion_array){
var _existing_completion = function(item, completion_array){
for( var i=0; i < completion_array.length; i++) {
if (completion_array[i].trim().substr(-item.length) == item) {
return true;
@ -143,13 +148,17 @@ var IPython = (function (IPython) {
// one kernel completion came back, finish_completing will be called with the results
// we fork here and directly call finish completing if kernel is busy
var cursor_pos = utils.to_absolute_cursor_pos(this.editor, cur);
if (this.skip_kernel_completion) {
this.finish_completing({
'matches': [],
matched_text: ""
});
this.finish_completing({ content: {
matches: [],
cursor_start: cursor_pos,
cursor_end: cursor_pos,
}});
} else {
this.cell.kernel.complete(line, cur.ch, $.proxy(this.finish_completing, this));
this.cell.kernel.complete(this.editor.getValue(), cursor_pos,
$.proxy(this.finish_completing, this)
);
}
};
@ -157,7 +166,8 @@ var IPython = (function (IPython) {
// let's build a function that wrap all that stuff into what is needed
// for the new completer:
var content = msg.content;
var matched_text = content.matched_text;
var start = content.cursor_start;
var end = content.cursor_end;
var matches = content.matches;
var cur = this.editor.getCursor();
@ -165,7 +175,8 @@ var IPython = (function (IPython) {
var filtered_results = [];
//remove results from context completion
//that are already in kernel completion
for (var i=0; i < results.length; i++) {
var i;
for (i=0; i < results.length; i++) {
if (!_existing_completion(results[i].str, matches)) {
filtered_results.push(results[i]);
}
@ -174,18 +185,12 @@ var IPython = (function (IPython) {
// append the introspection result, in order, at at the beginning of
// the table and compute the replacement range from current cursor
// positon and matched_text length.
for (var i = matches.length - 1; i >= 0; --i) {
for (i = matches.length - 1; i >= 0; --i) {
filtered_results.unshift({
str: matches[i],
type: "introspection",
from: {
line: cur.line,
ch: cur.ch - matched_text.length
},
to: {
line: cur.line,
ch: cur.ch
}
from: utils.from_absolute_cursor_pos(this.editor, start),
to: utils.from_absolute_cursor_pos(this.editor, end)
});
}
@ -249,8 +254,9 @@ var IPython = (function (IPython) {
// After everything is on the page, compute the postion.
// We put it above the code if it is too close to the bottom of the page.
cur.ch = cur.ch-matched_text.length;
var pos = this.editor.cursorCoords(cur);
var pos = this.editor.cursorCoords(
utils.from_absolute_cursor_pos(this.editor, start)
);
var left = pos.left-3;
var top;
var cheight = this.complete.height();

@ -1,9 +1,5 @@
//----------------------------------------------------------------------------
// Copyright (C) 2008 The IPython Development Team
//
// Distributed under the terms of the BSD License. The full license is in
// the file COPYING, distributed as part of this software.
//----------------------------------------------------------------------------
// Copyright (c) IPython Development Team.
// Distributed under the terms of the Modified BSD License.
//============================================================================
// OutputArea
@ -221,15 +217,18 @@ var IPython = (function (IPython) {
json = content.data;
json.output_type = msg_type;
json.metadata = content.metadata;
} else if (msg_type === "pyout") {
} else if (msg_type === "execute_result") {
json = content.data;
json.output_type = msg_type;
json.metadata = content.metadata;
json.prompt_number = content.execution_count;
} else if (msg_type === "pyerr") {
} else if (msg_type === "error") {
json.ename = content.ename;
json.evalue = content.evalue;
json.traceback = content.traceback;
} else {
console.log("unhandled output message", msg);
return;
}
this.append_output(json);
};
@ -283,10 +282,10 @@ var IPython = (function (IPython) {
needs_height_reset = true;
}
if (json.output_type === 'pyout') {
this.append_pyout(json);
} else if (json.output_type === 'pyerr') {
this.append_pyerr(json);
if (json.output_type === 'execute_result') {
this.append_execute_result(json);
} else if (json.output_type === 'error') {
this.append_error(json);
} else if (json.output_type === 'stream') {
this.append_stream(json);
}
@ -406,7 +405,7 @@ var IPython = (function (IPython) {
};
OutputArea.prototype.append_pyout = function (json) {
OutputArea.prototype.append_execute_result = function (json) {
var n = json.prompt_number || ' ';
var toinsert = this.create_output_area();
if (this.prompt_area) {
@ -414,7 +413,7 @@ var IPython = (function (IPython) {
}
var inserted = this.append_mime_type(json, toinsert);
if (inserted) {
inserted.addClass('output_pyout');
inserted.addClass('output_result');
}
this._safe_append(toinsert);
// If we just output latex, typeset it.
@ -426,7 +425,7 @@ var IPython = (function (IPython) {
};
OutputArea.prototype.append_pyerr = function (json) {
OutputArea.prototype.append_error = function (json) {
var tb = json.traceback;
if (tb !== undefined && tb.length > 0) {
var s = '';
@ -438,7 +437,7 @@ var IPython = (function (IPython) {
var toinsert = this.create_output_area();
var append_text = OutputArea.append_map['text/plain'];
if (append_text) {
append_text.apply(this, [s, {}, toinsert]).addClass('output_pyerr');
append_text.apply(this, [s, {}, toinsert]).addClass('output_error');
}
this._safe_append(toinsert);
}
@ -746,6 +745,8 @@ var IPython = (function (IPython) {
// disable any other raw_inputs, if they are left around
$("div.output_subarea.raw_input_container").remove();
var input_type = content.password ? 'password' : 'text';
area.append(
$("<div/>")
.addClass("box-flex1 output_subarea raw_input_container")
@ -757,7 +758,7 @@ var IPython = (function (IPython) {
.append(
$("<input/>")
.addClass("raw_input")
.attr('type', 'text')
.attr('type', input_type)
.attr("size", 47)
.keydown(function (event, ui) {
// make sure we submit on enter,
@ -786,10 +787,15 @@ var IPython = (function (IPython) {
var theprompt = container.find("span.raw_input_prompt");
var theinput = container.find("input.raw_input");
var value = theinput.val();
var echo = value;
// don't echo if it's a password
if (theinput.attr('type') == 'password') {
echo = '········';
}
var content = {
output_type : 'stream',
name : 'stdout',
text : theprompt.text() + value + '\n'
text : theprompt.text() + echo + '\n'
}
// remove form container
container.parent().remove();
@ -850,11 +856,26 @@ var IPython = (function (IPython) {
for (var i=0; i<len; i++) {
data = outputs[i];
var msg_type = data.output_type;
if (msg_type === "display_data" || msg_type === "pyout") {
if (msg_type == "pyout") {
// pyout message has been renamed to execute_result,
// but the nbformat has not been updated,
// so transform back to pyout for json.
msg_type = data.output_type = "execute_result";
} else if (msg_type == "pyerr") {
// pyerr message has been renamed to error,
// but the nbformat has not been updated,
// so transform back to pyerr for json.
msg_type = data.output_type = "error";
}
if (msg_type === "display_data" || msg_type === "execute_result") {
// convert short keys to mime keys
// TODO: remove mapping of short keys when we update to nbformat 4
data = this.rename_keys(data, OutputArea.mime_map_r);
data.metadata = this.rename_keys(data.metadata, OutputArea.mime_map_r);
// msg spec JSON is an object, nbformat v3 JSON is a JSON string
if (data["application/json"] !== undefined && typeof data["application/json"] === 'string') {
data["application/json"] = JSON.parse(data["application/json"]);
}
}
this.append_output(data);
@ -869,10 +890,25 @@ var IPython = (function (IPython) {
for (var i=0; i<len; i++) {
data = this.outputs[i];
var msg_type = data.output_type;
if (msg_type === "display_data" || msg_type === "pyout") {
if (msg_type === "display_data" || msg_type === "execute_result") {
// convert mime keys to short keys
data = this.rename_keys(data, OutputArea.mime_map);
data.metadata = this.rename_keys(data.metadata, OutputArea.mime_map);
// msg spec JSON is an object, nbformat v3 JSON is a JSON string
if (data.json !== undefined && typeof data.json !== 'string') {
data.json = JSON.stringify(data.json);
}
}
if (msg_type == "execute_result") {
// pyout message has been renamed to execute_result,
// but the nbformat has not been updated,
// so transform back to pyout for json.
data.output_type = "pyout";
} else if (msg_type == "error") {
// pyerr message has been renamed to error,
// but the nbformat has not been updated,
// so transform back to pyerr for json.
data.output_type = "pyerr";
}
outputs[i] = data;
}

@ -1,9 +1,5 @@
//----------------------------------------------------------------------------
// Copyright (C) 2008-2011 The IPython Development Team
//
// Distributed under the terms of the BSD License. The full license is in
// the file COPYING, distributed as part of this software.
//----------------------------------------------------------------------------
// Copyright (c) IPython Development Team.
// Distributed under the terms of the Modified BSD License.
//============================================================================
// Pager
@ -81,12 +77,18 @@ var IPython = (function (IPython) {
var that = this;
this.pager_element.bind('collapse_pager', function (event, extrap) {
var time = (extrap != undefined) ? ((extrap.duration != undefined ) ? extrap.duration : 'fast') : 'fast';
var time = 'fast';
if (extrap && extrap.duration) {
time = extrap.duration;
}
that.pager_element.hide(time);
});
this.pager_element.bind('expand_pager', function (event, extrap) {
var time = (extrap != undefined) ? ((extrap.duration != undefined ) ? extrap.duration : 'fast') : 'fast';
var time = 'fast';
if (extrap && extrap.duration) {
time = extrap.duration;
}
that.pager_element.show(time);
});
@ -103,12 +105,13 @@ var IPython = (function (IPython) {
that.toggle();
});
$([IPython.events]).on('open_with_text.Pager', function (event, data) {
if (data.text.trim() !== '') {
$([IPython.events]).on('open_with_text.Pager', function (event, payload) {
// FIXME: support other mime types
if (payload.data['text/plain'] && payload.data['text/plain'] !== "") {
that.clear();
that.expand();
that.append_text(data.text);
};
that.append_text(payload.data['text/plain']);
}
});
};
@ -117,7 +120,7 @@ var IPython = (function (IPython) {
if (this.expanded === true) {
this.expanded = false;
this.pager_element.add($('div#notebook')).trigger('collapse_pager', extrap);
};
}
};
@ -125,7 +128,7 @@ var IPython = (function (IPython) {
if (this.expanded !== true) {
this.expanded = true;
this.pager_element.add($('div#notebook')).trigger('expand_pager', extrap);
};
}
};
@ -134,7 +137,7 @@ var IPython = (function (IPython) {
this.collapse();
} else {
this.expand();
};
}
};
@ -160,8 +163,7 @@ var IPython = (function (IPython) {
pager_body.append(this.pager_element.clone().children());
w.document.close();
this.collapse();
}
};
Pager.prototype.append_text = function (text) {
// The only user content injected with this HTML call is escaped by

@ -1,9 +1,6 @@
//----------------------------------------------------------------------------
// Copyright (C) 2008-2011 The IPython Development Team
//
// Distributed under the terms of the BSD License. The full license is in
// the file COPYING, distributed as part of this software.
//----------------------------------------------------------------------------
// Copyright (c) IPython Development Team.
// Distributed under the terms of the Modified BSD License.
//============================================================================
// Tooltip
//============================================================================
@ -105,8 +102,8 @@ var IPython = (function (IPython) {
this.tooltip.append(this.text);
// function that will be called if you press tab 1, 2, 3... times in a row
this.tabs_functions = [function (cell, text) {
that._request_tooltip(cell, text);
this.tabs_functions = [function (cell, text, cursor) {
that._request_tooltip(cell, text, cursor);
}, function () {
that.expand();
}, function () {
@ -131,13 +128,10 @@ var IPython = (function (IPython) {
Tooltip.prototype.showInPager = function (cell) {
// reexecute last call in pager by appending ? to show back in pager
var that = this;
var callbacks = {'shell' : {
'payload' : {
'page' : $.proxy(cell._open_with_pager, cell)
}
}
};
cell.kernel.execute(that.name + '?', callbacks, {'silent': false, 'store_history': true});
var payload = {};
payload.text = that._reply.content.data['text/plain'];
$([IPython.events]).trigger('open_with_text.Pager', payload);
this.remove_and_cancel_tooltip();
};
@ -222,10 +216,9 @@ var IPython = (function (IPython) {
return Tooltip.last_token_re.exec(line);
};
Tooltip.prototype._request_tooltip = function (cell, line) {
Tooltip.prototype._request_tooltip = function (cell, text, cursor_pos) {
var callbacks = $.proxy(this._show, this);
var oir_token = this.extract_oir_token(line);
var msg_id = cell.kernel.object_info(oir_token, callbacks);
var msg_id = cell.kernel.inspect(text, cursor_pos, callbacks);
};
// make an imediate completion request
@ -236,10 +229,8 @@ var IPython = (function (IPython) {
this.cancel_pending();
var editor = cell.code_mirror;
var cursor = editor.getCursor();
var text = editor.getRange({
line: cursor.line,
ch: 0
}, cursor).trim();
var cursor_pos = utils.to_absolute_cursor_pos(editor, cursor);
var text = cell.get_text();
this._hide_if_no_docstring = hide_if_no_docstring;
@ -260,17 +251,12 @@ var IPython = (function (IPython) {
this.reset_tabs_function (cell, text);
}
// don't do anything if line beggin with '(' or is empty
if (text === "" || text === "(") {
return;
}
this.tabs_functions[this._consecutive_counter](cell, text);
this.tabs_functions[this._consecutive_counter](cell, text, cursor_pos);
// then if we are at the end of list function, reset
if (this._consecutive_counter == this.tabs_functions.length) {
this.reset_tabs_function (cell, text);
}
this.reset_tabs_function (cell, text, cursor);
}
return;
};
@ -302,6 +288,7 @@ var IPython = (function (IPython) {
Tooltip.prototype._show = function (reply) {
// move the bubble if it is not hidden
// otherwise fade it
this._reply = reply;
var content = reply.content;
if (!content.found) {
// object not found, nothing to show
@ -338,43 +325,14 @@ var IPython = (function (IPython) {
this.arrow.animate({
'left': posarrowleft + 'px'
});
// build docstring
var defstring = content.call_def;
if (!defstring) {
defstring = content.init_definition;
}
if (!defstring) {
defstring = content.definition;
}
var docstring = content.call_docstring;
if (!docstring) {
docstring = content.init_docstring;
}
if (!docstring) {
docstring = content.docstring;
}
if (!docstring) {
// For reals this time, no docstring
if (this._hide_if_no_docstring) {
return;
} else {
docstring = "<empty docstring>";
}
}
this._hidden = false;
this.tooltip.fadeIn('fast');
this.text.children().remove();
// This should support rich data types, but only text/plain for now
// Any HTML within the docstring is escaped by the fixConsole() method.
var pre = $('<pre/>').html(utils.fixConsole(docstring));
if (defstring) {
var defstring_html = $('<pre/>').html(utils.fixConsole(defstring));
this.text.append(defstring_html);
}
var pre = $('<pre/>').html(utils.fixConsole(content.data['text/plain']));
this.text.append(pre);
// keep scroll top to be sure to always see the first line
this.text.scrollTop(0);

@ -107,7 +107,7 @@ div.output_text {
line-height: @code_line_height;
}
/* stdout/stderr are 'text' as well as 'stream', but pyout/pyerr are *not* streams */
/* stdout/stderr are 'text' as well as 'stream', but execute_result/error are *not* streams */
div.output_stream {
}

@ -57,7 +57,8 @@ var IPython = (function (IPython) {
msg_id : utils.uuid(),
username : this.username,
session : this.session_id,
msg_type : msg_type
msg_type : msg_type,
version : "5.0"
},
metadata : metadata || {},
content : content,
@ -76,13 +77,13 @@ var IPython = (function (IPython) {
// Initialize the iopub handlers
Kernel.prototype.init_iopub_handlers = function () {
var output_types = ['stream', 'display_data', 'pyout', 'pyerr'];
var output_msg_types = ['stream', 'display_data', 'execute_result', 'error'];
this._iopub_handlers = {};
this.register_iopub_handler('status', $.proxy(this._handle_status_message, this));
this.register_iopub_handler('clear_output', $.proxy(this._handle_clear_output, this));
for (var i=0; i < output_types.length; i++) {
this.register_iopub_handler(output_types[i], $.proxy(this._handle_output_message, this));
for (var i=0; i < output_msg_types.length; i++) {
this.register_iopub_handler(output_msg_types[i], $.proxy(this._handle_output_message, this));
}
};
@ -246,7 +247,7 @@ var IPython = (function (IPython) {
* Get kernel info
*
* @param callback {function}
* @method object_info
* @method kernel_info
*
* When calling this method, pass a callback function that expects one argument.
* The callback will be passed the complete `kernel_info_reply` message documented
@ -263,28 +264,27 @@ var IPython = (function (IPython) {
/**
* Get info on an object
*
* @param objname {string}
* @param code {string}
* @param cursor_pos {integer}
* @param callback {function}
* @method object_info
* @method inspect
*
* When calling this method, pass a callback function that expects one argument.
* The callback will be passed the complete `object_info_reply` message documented
* The callback will be passed the complete `inspect_reply` message documented
* [here](http://ipython.org/ipython-doc/dev/development/messaging.html#object-information)
*/
Kernel.prototype.object_info = function (objname, callback) {
Kernel.prototype.inspect = function (code, cursor_pos, callback) {
var callbacks;
if (callback) {
callbacks = { shell : { reply : callback } };
}
if (typeof(objname) !== null && objname !== null) {
var content = {
oname : objname.toString(),
detail_level : 0,
};
return this.send_shell_message("object_info_request", content, callbacks);
}
return;
var content = {
code : code,
cursor_pos : cursor_pos,
detail_level : 0,
};
return this.send_shell_message("inspect_request", content, callbacks);
};
/**
@ -302,7 +302,6 @@ var IPython = (function (IPython) {
* @param {object} [options]
* @param [options.silent=false] {Boolean}
* @param [options.user_expressions=empty_dict] {Dict}
* @param [options.user_variables=empty_list] {List od Strings}
* @param [options.allow_stdin=false] {Boolean} true|false
*
* @example
@ -312,7 +311,6 @@ var IPython = (function (IPython) {
*
* options = {
* silent : true,
* user_variables : [],
* user_expressions : {},
* allow_stdin : false
* }
@ -342,7 +340,6 @@ var IPython = (function (IPython) {
code : code,
silent : true,
store_history : false,
user_variables : [],
user_expressions : {},
allow_stdin : false
};
@ -363,21 +360,19 @@ var IPython = (function (IPython) {
* [here](http://ipython.org/ipython-doc/dev/development/messaging.html#complete)
*
* @method complete
* @param line {integer}
* @param code {string}
* @param cursor_pos {integer}
* @param callback {function}
*
*/
Kernel.prototype.complete = function (line, cursor_pos, callback) {
Kernel.prototype.complete = function (code, cursor_pos, callback) {
var callbacks;
if (callback) {
callbacks = { shell : { reply : callback } };
}
var content = {
text : '',
line : line,
block : null,
cursor_pos : cursor_pos
code : code,
cursor_pos : cursor_pos,
};
return this.send_shell_message("complete_request", content, callbacks);
};
@ -573,7 +568,7 @@ var IPython = (function (IPython) {
};
// handle an output message (pyout, display_data, etc.)
// handle an output message (execute_result, display_data, etc.)
Kernel.prototype._handle_output_message = function (msg) {
var callbacks = this.get_callbacks_for_msg(msg.parent_header.msg_id);
if (!callbacks || !callbacks.iopub) {

@ -14,10 +14,9 @@ b64_image_data = {
casper.notebook_test(function () {
// this.printLog();
this.test_img_shape = function(fmt, retina) {
this.thenEvaluate(function (b64data, retina) {
IPython.notebook.get_cell(0).clear_output();
IPython.notebook.insert_cell_at_index(0, "code");
var cell = IPython.notebook.get_cell(0);
cell.set_text([
"import base64",

@ -33,7 +33,7 @@ function assert_has(short_name, json, result, result2) {
}
// helper function for checkout that the first two cells have a particular
// output_type (either 'pyout' or 'display_data'), and checks the to/fromJSON
// output_type (either 'execute_result' or 'display_data'), and checks the to/fromJSON
// for a set of mimetype keys, using their short names ('javascript', 'text',
// 'png', etc).
function check_output_area(output_type, keys) {
@ -109,7 +109,7 @@ casper.notebook_test(function () {
});
this.then(function () {
check_output_area.apply(this, ['pyout', ['text', 'json']]);
check_output_area.apply(this, ['execute_result', ['text', 'json']]);
});
this.then(function() {
@ -127,7 +127,7 @@ casper.notebook_test(function () {
});
this.then(function ( ) {
check_output_area.apply(this, ['pyout', ['text', 'latex']]);
check_output_area.apply(this, ['execute_result', ['text', 'latex']]);
});
this.then(function() {
@ -145,7 +145,7 @@ casper.notebook_test(function () {
});
this.then(function ( ) {
check_output_area.apply(this, ['pyout', ['text', 'html']]);
check_output_area.apply(this, ['execute_result', ['text', 'html']]);
});
this.then(function() {
@ -165,7 +165,7 @@ casper.notebook_test(function () {
this.thenEvaluate(function() { IPython.notebook.save_notebook(); });
this.then(function ( ) {
check_output_area.apply(this, ['pyout', ['text', 'png']]);
check_output_area.apply(this, ['execute_result', ['text', 'png']]);
});
this.then(function() {
@ -184,7 +184,7 @@ casper.notebook_test(function () {
});
this.then(function ( ) {
check_output_area.apply(this, ['pyout', ['text', 'jpeg']]);
check_output_area.apply(this, ['execute_result', ['text', 'jpeg']]);
});
this.then(function() {
@ -202,7 +202,7 @@ casper.notebook_test(function () {
});
this.then(function ( ) {
check_output_area.apply(this, ['pyout', ['text', 'svg']]);
check_output_area.apply(this, ['execute_result', ['text', 'svg']]);
});
this.then(function() {
@ -238,7 +238,7 @@ casper.notebook_test(function () {
'display_data custom mimetype ' + long_name);
var result = this.get_output_cell(0, 1);
this.test.assertTrue(result.hasOwnProperty(long_name),
'pyout custom mimetype ' + long_name);
'execute_result custom mimetype ' + long_name);
});

@ -14,7 +14,7 @@ casper.notebook_test(function () {
this.evaluate(function () {
var cell = IPython.notebook.get_cell(0);
cell.set_text( "dp = get_ipython().display_pub\n" +
"dp.publish('test', {'text/plain' : '5', 'image/png' : 5})"
"dp.publish({'text/plain' : '5', 'image/png' : 5})"
);
cell.execute();
});

Loading…
Cancel
Save