Show More
@@ -15,6 +15,8 b' def code_to_line(code, cursor_pos):' | |||
|
15 | 15 | |
|
16 | 16 | For adapting ``complete_`` and ``object_info_request``. |
|
17 | 17 | """ |
|
18 | if not code: | |
|
19 | return "", 0 | |
|
18 | 20 | for line in code.splitlines(True): |
|
19 | 21 | n = len(line) |
|
20 | 22 | if cursor_pos > n: |
@@ -8,7 +8,7 b' import json' | |||
|
8 | 8 | from unittest import TestCase |
|
9 | 9 | import nose.tools as nt |
|
10 | 10 | |
|
11 | from IPython.kernel.adapter import adapt, V4toV5, V5toV4 | |
|
11 | from IPython.kernel.adapter import adapt, V4toV5, V5toV4, code_to_line | |
|
12 | 12 | from IPython.kernel.zmq.session import Session |
|
13 | 13 | |
|
14 | 14 | |
@@ -20,6 +20,10 b' def test_default_version():' | |||
|
20 | 20 | adapted = adapt(original) |
|
21 | 21 | nt.assert_equal(adapted['header']['version'], V4toV5.version) |
|
22 | 22 | |
|
23 | def test_code_to_line_no_code(): | |
|
24 | line, pos = code_to_line("", 0) | |
|
25 | nt.assert_equal(line, "") | |
|
26 | nt.assert_equal(pos, 0) | |
|
23 | 27 | |
|
24 | 28 | class AdapterTest(TestCase): |
|
25 | 29 |
General Comments 0
You need to be logged in to leave comments.
Login now