-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test multiple expressions in console and notebook modes (#559)
- Loading branch information
Showing
4 changed files
with
133 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use ark::fixtures::DummyArkFrontendNotebook; | ||
|
||
#[test] | ||
fn test_notebook_execute_request() { | ||
let frontend = DummyArkFrontendNotebook::lock(); | ||
|
||
frontend.send_execute_request("42"); | ||
frontend.recv_iopub_busy(); | ||
|
||
let input = frontend.recv_iopub_execute_input(); | ||
assert_eq!(input.code, "42"); | ||
assert_eq!(frontend.recv_iopub_execute_result(), "[1] 42"); | ||
|
||
frontend.recv_iopub_idle(); | ||
|
||
assert_eq!(frontend.recv_shell_execute_reply(), input.execution_count); | ||
} | ||
|
||
#[test] | ||
fn test_notebook_execute_request_multiple_expressions() { | ||
let frontend = DummyArkFrontendNotebook::lock(); | ||
|
||
let code = "1\nprint(2)\n3"; | ||
frontend.send_execute_request(code); | ||
frontend.recv_iopub_busy(); | ||
|
||
let input = frontend.recv_iopub_execute_input(); | ||
assert_eq!(input.code, code); | ||
|
||
// Printed output | ||
assert_eq!(frontend.recv_iopub_stream_stdout(), "[1] 2\n"); | ||
|
||
// Unlike console mode, we don't get intermediate results in notebooks | ||
assert_eq!(frontend.recv_iopub_execute_result(), "[1] 3"); | ||
|
||
frontend.recv_iopub_idle(); | ||
|
||
assert_eq!(frontend.recv_shell_execute_reply(), input.execution_count); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters