Show More
@@ -334,15 +334,18 b' class InteractiveShell(SingletonConfigurable):' | |||
|
334 | 334 | filename = Unicode("<ipython console>") |
|
335 | 335 | ipython_dir= Unicode('').tag(config=True) # Set to get_ipython_dir() in __init__ |
|
336 | 336 | |
|
337 | # Input splitter, to transform input line by line and detect when a block | |
|
338 | # is ready to be executed. | |
|
339 | input_splitter = Instance('IPython.core.inputsplitter.IPythonInputSplitter', | |
|
340 | (), {'line_input_checker': True}) | |
|
341 | ||
|
342 | # Used to transform cells before running them. | |
|
337 | # Used to transform cells before running them, and check whether code is complete | |
|
343 | 338 | input_transformer_manager = Instance('IPython.core.inputtransformer2.TransformerManager', |
|
344 | 339 | ()) |
|
345 | 340 | |
|
341 | @property | |
|
342 | def input_splitter(self): | |
|
343 | """Make this available for compatibility | |
|
344 | ||
|
345 | ipykernel currently uses shell.input_splitter.check_complete | |
|
346 | """ | |
|
347 | return self.input_transformer_manager | |
|
348 | ||
|
346 | 349 | logstart = Bool(False, help= |
|
347 | 350 | """ |
|
348 | 351 | Start logging to the default log file in overwrite mode. |
@@ -179,10 +179,11 b' def test_transform_help():' | |||
|
179 | 179 | nt.assert_equal(tf.transform(HELP_MULTILINE[0]), HELP_MULTILINE[2]) |
|
180 | 180 | |
|
181 | 181 | def test_check_complete(): |
|
182 |
|
|
|
183 |
nt.assert_equal( |
|
|
184 |
nt.assert_equal( |
|
|
185 |
nt.assert_equal( |
|
|
186 |
nt.assert_equal( |
|
|
187 |
nt.assert_equal( |
|
|
188 |
nt.assert_equal( |
|
|
182 | cc = ipt2.TransformerManager().check_complete | |
|
183 | nt.assert_equal(cc("a = 1"), ('complete', None)) | |
|
184 | nt.assert_equal(cc("for a in range(5):"), ('incomplete', 4)) | |
|
185 | nt.assert_equal(cc("raise = 2"), ('invalid', None)) | |
|
186 | nt.assert_equal(cc("a = [1,\n2,"), ('incomplete', 0)) | |
|
187 | nt.assert_equal(cc("a = '''\n hi"), ('incomplete', 3)) | |
|
188 | nt.assert_equal(cc("def a():\n x=1\n global x"), ('invalid', None)) | |
|
189 | nt.assert_equal(cc("a \\ "), ('invalid', None)) # Nothing allowed after backslash |
General Comments 0
You need to be logged in to leave comments.
Login now