Show More
@@ -9,6 +9,7 recurring bugs we seem to encounter with high-level interaction. | |||
|
9 | 9 | # Copyright (c) IPython Development Team. |
|
10 | 10 | # Distributed under the terms of the Modified BSD License. |
|
11 | 11 | |
|
12 | import asyncio | |
|
12 | 13 | import ast |
|
13 | 14 | import os |
|
14 | 15 | import signal |
@@ -24,6 +25,7 import nose.tools as nt | |||
|
24 | 25 | |
|
25 | 26 | from IPython.core.error import InputRejected |
|
26 | 27 | from IPython.core.inputtransformer import InputTransformer |
|
28 | from IPython.core import interactiveshell | |
|
27 | 29 | from IPython.testing.decorators import ( |
|
28 | 30 | skipif, skip_win32, onlyif_unicode_paths, onlyif_cmds_exist, |
|
29 | 31 | ) |
@@ -928,3 +930,19 def test_custom_exc_count(): | |||
|
928 | 930 | ip.set_custom_exc((), None) |
|
929 | 931 | nt.assert_equal(hook.call_count, 1) |
|
930 | 932 | nt.assert_equal(ip.execution_count, before + 1) |
|
933 | ||
|
934 | ||
|
935 | def test_run_cell_async(): | |
|
936 | loop = asyncio.get_event_loop() | |
|
937 | ip.run_cell("import asyncio") | |
|
938 | coro = ip.run_cell_async("await asyncio.sleep(0.01)\n5") | |
|
939 | assert asyncio.iscoroutine(coro) | |
|
940 | result = loop.run_until_complete(coro) | |
|
941 | assert isinstance(result, interactiveshell.ExecutionResult) | |
|
942 | assert result.result == 5 | |
|
943 | ||
|
944 | ||
|
945 | def test_should_run_async(): | |
|
946 | assert not ip.should_run_async("a = 5") | |
|
947 | assert ip.should_run_async("await x") | |
|
948 | assert ip.should_run_async("import asyncio; await asyncio.sleep(1)") |
General Comments 0
You need to be logged in to leave comments.
Login now