forked from VimPlug/jedi
Add another failing case
This commit is contained in:
@@ -395,21 +395,42 @@ class TestRegression(TestBase):
|
|||||||
for c in s.get_commands():
|
for c in s.get_commands():
|
||||||
self.assertEqual(c.execution.end_pos[1], i)
|
self.assertEqual(c.execution.end_pos[1], i)
|
||||||
|
|
||||||
|
def check_definition_by_marker(self, source, after_cursor, names):
|
||||||
|
r"""
|
||||||
|
Find definitions specified by `after_cursor` and check what found
|
||||||
|
|
||||||
|
For example, for the following configuration, you can pass
|
||||||
|
``after_cursor = 'y)'``.::
|
||||||
|
|
||||||
|
function(
|
||||||
|
x, y)
|
||||||
|
\
|
||||||
|
`- You want cursor to be here
|
||||||
|
"""
|
||||||
|
source = textwrap.dedent(source)
|
||||||
|
for (i, line) in enumerate(source.splitlines()):
|
||||||
|
if after_cursor in line:
|
||||||
|
break
|
||||||
|
column = len(line) - len(after_cursor)
|
||||||
|
defs = self.goto_definitions(source, (i + 1, column))
|
||||||
|
self.assertEqual([d.name for d in defs], names)
|
||||||
|
|
||||||
def test_backslash_continuation(self):
|
def test_backslash_continuation(self):
|
||||||
"""
|
"""
|
||||||
Test that ModuleWithCursor.get_path_until_cursor handles continuation
|
Test that ModuleWithCursor.get_path_until_cursor handles continuation
|
||||||
"""
|
"""
|
||||||
source = textwrap.dedent(r"""
|
self.check_definition_by_marker(r"""
|
||||||
x = 0
|
x = 0
|
||||||
a = \
|
a = \
|
||||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, x] # <-- here
|
[1, 2, 3, 4, 5, 6, 7, 8, 9, x] # <-- here
|
||||||
""")
|
""", '] # <-- here', ['int'])
|
||||||
for (i, line) in enumerate(source.splitlines()):
|
|
||||||
if '<-- here' in line:
|
def test_backslash_continuation_and_bracket(self):
|
||||||
break
|
self.check_definition_by_marker(r"""
|
||||||
column = len(line) - len('] # <-- here')
|
x = 0
|
||||||
defs = self.goto_definitions(source, (i + 1, column))
|
a = \
|
||||||
self.assertEqual([d.name for d in defs], ['int'])
|
[1, 2, 3, 4, 5, 6, 7, 8, 9, (x)] # <-- here
|
||||||
|
""", '(x)] # <-- here', [None])
|
||||||
|
|
||||||
|
|
||||||
class TestDocstring(TestBase):
|
class TestDocstring(TestBase):
|
||||||
|
|||||||
Reference in New Issue
Block a user