8000 Merge pull request #265 from takluyver/cell-magic-is-complete · ipython/ipykernel@29abbed · GitHub
[go: up one dir, main page]

Skip to content

Commit 29abbed

Browse files
authored
Merge pull request #265 from takluyver/cell-magic-is-complete
Fix is_complete response with cell magics
2 parents d9f79e1 + 829b5e5 commit 29abbed

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ def do_shutdown(self, restart):
355355
return dict(status='ok', restart=restart)
356356

357357
def do_is_complete(self, code):
358-
status, indent_spaces = self.shell.input_transformer_manager.check_complete(code)
358+
status, indent_spaces = self.shell.input_splitter.check_complete(code)
359359
r = {'status': status}
360360
if status == 'incomplete':
361361
r['indent'] = ' ' * indent_spaces
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def test_is_complete():
224224
reply = kc.get_shell_msg(block=True, timeout=TIMEOUT)
225225
assert reply['content']['status'] == 'complete'
226226

227-
# SyntaxError should mean it's complete
227+
# SyntaxError
228228
kc.is_complete('raise = 2')
229229
reply = kc.get_shell_msg(block=True, timeout=TIMEOUT)
230230
assert reply['content']['status'] == 'invalid'
@@ -234,6 +234,11 @@ def test_is_complete():
234234
assert reply['content']['status'] == 'incomplete'
235235
assert reply['content']['indent'] == ''
236236

237+
# Cell magic ends on two blank lines for console UIs
238+
kc.is_complete('%%timeit\na\n\n')
239+
reply = kc.get_shell_msg(block=True, timeout=TIMEOUT)
240+
assert reply['content']['status'] == 'complete'
241+
237242

238243
def test_complete():
239244
with kernel() as kc: