##// END OF EJS Templates
Merge pull request #6657 from takluyver/adapt-no-code-to-line...
Thomas Kluyver -
r18274:b4de39a2 merge
parent child Browse files
Show More
@@ -15,6 +15,8 b' def code_to_line(code, cursor_pos):'
15
15
16 For adapting ``complete_`` and ``object_info_request``.
16 For adapting ``complete_`` and ``object_info_request``.
17 """
17 """
18 if not code:
19 return "", 0
18 for line in code.splitlines(True):
20 for line in code.splitlines(True):
19 n = len(line)
21 n = len(line)
20 if cursor_pos > n:
22 if cursor_pos > n:
@@ -8,7 +8,7 b' import json'
8 from unittest import TestCase
8 from unittest import TestCase
9 import nose.tools as nt
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 from IPython.kernel.zmq.session import Session
12 from IPython.kernel.zmq.session import Session
13
13
14
14
@@ -20,6 +20,10 b' def test_default_version():'
20 adapted = adapt(original)
20 adapted = adapt(original)
21 nt.assert_equal(adapted['header']['version'], V4toV5.version)
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 class AdapterTest(TestCase):
28 class AdapterTest(TestCase):
25
29
General Comments 0
You need to be logged in to leave comments. Login now