(expected, cell, cursor_pos)
| 7 | from IPython.utils.tokenutil import token_at_cursor, line_at_cursor |
| 8 | |
| 9 | def expect_token(expected, cell, cursor_pos): |
| 10 | token = token_at_cursor(cell, cursor_pos) |
| 11 | offset = 0 |
| 12 | for line in cell.splitlines(): |
| 13 | if offset + len(line) >= cursor_pos: |
| 14 | break |
| 15 | else: |
| 16 | offset += len(line)+1 |
| 17 | column = cursor_pos - offset |
| 18 | line_with_cursor = '%s|%s' % (line[:column], line[column:]) |
| 19 | nt.assert_equal(token, expected, |
| 20 | "Expected %r, got %r in: %r (pos %i)" % ( |
| 21 | expected, token, line_with_cursor, cursor_pos) |
| 22 | ) |
| 23 | |
| 24 | def test_simple(): |
| 25 | cell = "foo" |
no test coverage detected