##// END OF EJS Templates
[utils][tests][tokenutil] Remove nose
Samuel Gaist -
Show More
@@ -2,7 +2,6 b''
2 2 # Copyright (c) IPython Development Team.
3 3 # Distributed under the terms of the Modified BSD License.
4 4
5 import nose.tools as nt
6 5 import pytest
7 6 from IPython.testing.decorators import skip_iptest_but_not_pytest
8 7
@@ -17,13 +16,16 b' def expect_token(expected, cell, cursor_pos):'
17 16 else:
18 17 offset += len(line)+1
19 18 column = cursor_pos - offset
20 line_with_cursor = '%s|%s' % (line[:column], line[column:])
21 nt.assert_equal(token, expected,
22 "Expected %r, got %r in: %r (pos %i)" % (
23 expected, token, line_with_cursor, cursor_pos)
19 line_with_cursor = "%s|%s" % (line[:column], line[column:])
20 assert token == expected, "Expected %r, got %r in: %r (pos %i)" % (
21 expected,
22 token,
23 line_with_cursor,
24 cursor_pos,
24 25 )
25 26
26 def test_simple():
27
28 def test_simple():
27 29 cell = "foo"
28 30 for i in range(len(cell)):
29 31 expect_token("foo", cell, i)
@@ -107,20 +109,20 b' def test_attrs():'
107 109 def test_line_at_cursor():
108 110 cell = ""
109 111 (line, offset) = line_at_cursor(cell, cursor_pos=11)
110 nt.assert_equal(line, "")
111 nt.assert_equal(offset, 0)
112 assert line == ""
113 assert offset == 0
112 114
113 115 # The position after a newline should be the start of the following line.
114 116 cell = "One\nTwo\n"
115 117 (line, offset) = line_at_cursor(cell, cursor_pos=4)
116 nt.assert_equal(line, "Two\n")
117 nt.assert_equal(offset, 4)
118 assert line == "Two\n"
119 assert offset == 4
118 120
119 121 # The end of a cell should be on the last line
120 122 cell = "pri\npri"
121 123 (line, offset) = line_at_cursor(cell, cursor_pos=7)
122 nt.assert_equal(line, "pri")
123 nt.assert_equal(offset, 4)
124 assert line == "pri"
125 assert offset == 4
124 126
125 127
126 128 @pytest.mark.parametrize(
General Comments 0
You need to be logged in to leave comments. Login now