##// END OF EJS Templates
refactor to improve cell switching in edit mode...
refactor to improve cell switching in edit mode This code was repeated in both CodeCell and TextCell, both of which are extensions of Cell, so this just unifies the logic in Cell. TextCell had logic here to check if the cell was rendered or not, but I don't believe it is possible to end up triggering such a code path. (Should that be required, I can always just add back these methods to TextCell, performing the .rendered==True check, and calling the Cell prior to this, code mirror at_top would only return true on if the cursor was at the first character of the top line. Now, pressing up arrow on any character on the top line will take you to the cell above. The same applies for the bottom line. Pressing down arrow would only go to the next cell if the cursor was at a location *after* the last character (something that is only possible to achieve in vim mode if the last line is empty, for example). Now, down arrow on any character of the last line will go to the next cell.

File last commit:

r11124:9567c77a
r15754:d60e793e
Show More
test_splitinput.py
42 lines | 1.4 KiB | text/x-python | PythonLexer
/ IPython / core / tests / test_splitinput.py
Thomas Kluyver
Update split_user_input unicode test.
r4769 # coding: utf-8
Thomas Kluyver
Remove unused imports from IPython.core
r11124 import nose.tools as nt
from IPython.core.splitinput import split_user_input, LineInfo
Thomas Kluyver
Reuse common code for inputsplitter and prefilter.
r4746 from IPython.testing import tools as tt
Thomas Kluyver
Update split_user_input unicode test.
r4769 from IPython.utils import py3compat
Thomas Kluyver
Reuse common code for inputsplitter and prefilter.
r4746
tests = [
('x=1', ('', '', 'x', '=1')),
('?', ('', '?', '', '')),
('??', ('', '??', '', '')),
(' ?', (' ', '?', '', '')),
(' ??', (' ', '??', '', '')),
('??x', ('', '??', 'x', '')),
('?x=1', ('', '?', 'x', '=1')),
('!ls', ('', '!', 'ls', '')),
(' !ls', (' ', '!', 'ls', '')),
('!!ls', ('', '!!', 'ls', '')),
(' !!ls', (' ', '!!', 'ls', '')),
(',ls', ('', ',', 'ls', '')),
(';ls', ('', ';', 'ls', '')),
(' ;ls', (' ', ';', 'ls', '')),
('f.g(x)', ('', '', 'f.g', '(x)')),
('f.g (x)', ('', '', 'f.g', '(x)')),
Fernando Perez
Fix split_user_input to correctly handle %% escape for cell magics.
r6998 ('?%hist1', ('', '?', '%hist1', '')),
('?%%hist2', ('', '?', '%%hist2', '')),
('??%hist3', ('', '??', '%hist3', '')),
('??%%hist4', ('', '??', '%%hist4', '')),
Thomas Kluyver
Reuse common code for inputsplitter and prefilter.
r4746 ('?x*', ('', '?', 'x*', '')),
]
Thomas Kluyver
Update split_user_input unicode test.
r4769 if py3compat.PY3:
tests.append((u"Pérez Fernando", (u'', u'', u'Pérez', u'Fernando')))
else:
tests.append((u"Pérez Fernando", (u'', u'', u'P', u'érez Fernando')))
Thomas Kluyver
Reuse common code for inputsplitter and prefilter.
r4746
def test_split_user_input():
return tt.check_pairs(split_user_input, tests)
Thomas Kluyver
Remove unused imports from IPython.core
r11124
def test_LineInfo():
"""Simple test for LineInfo construction and str()"""
linfo = LineInfo(' %cd /home')
nt.assert_equal(str(linfo), 'LineInfo [ |%|cd|/home]')