MCPcopy Create free account
hub / github.com/ipython/ipython / test_line_at_cursor

Function test_line_at_cursor

IPython/utils/tests/test_tokenutil.py:105–121  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

103 expect_token(expected, cell, i)
104
105def test_line_at_cursor():
106 cell = ""
107 (line, offset) = line_at_cursor(cell, cursor_pos=11)
108 nt.assert_equal(line, "")
109 nt.assert_equal(offset, 0)
110
111 # The position after a newline should be the start of the following line.
112 cell = "One\nTwo\n"
113 (line, offset) = line_at_cursor(cell, cursor_pos=4)
114 nt.assert_equal(line, "Two\n")
115 nt.assert_equal(offset, 4)
116
117 # The end of a cell should be on the last line
118 cell = "pri\npri"
119 (line, offset) = line_at_cursor(cell, cursor_pos=7)
120 nt.assert_equal(line, "pri")
121 nt.assert_equal(offset, 4)
122
123def test_multiline_statement():
124 cell = """a = (1,

Callers

nothing calls this directly

Calls 1

line_at_cursorFunction · 0.90

Tested by

no test coverage detected