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():
|
||||
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):
|
||||
"""
|
||||
Test that ModuleWithCursor.get_path_until_cursor handles continuation
|
||||
"""
|
||||
source = textwrap.dedent(r"""
|
||||
self.check_definition_by_marker(r"""
|
||||
x = 0
|
||||
a = \
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, x] # <-- here
|
||||
""")
|
||||
for (i, line) in enumerate(source.splitlines()):
|
||||
if '<-- here' in line:
|
||||
break
|
||||
column = len(line) - len('] # <-- here')
|
||||
defs = self.goto_definitions(source, (i + 1, column))
|
||||
self.assertEqual([d.name for d in defs], ['int'])
|
||||
""", '] # <-- here', ['int'])
|
||||
|
||||
def test_backslash_continuation_and_bracket(self):
|
||||
self.check_definition_by_marker(r"""
|
||||
x = 0
|
||||
a = \
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, (x)] # <-- here
|
||||
""", '(x)] # <-- here', [None])
|
||||
|
||||
|
||||
class TestDocstring(TestBase):
|
||||
|
||||
Reference in New Issue
Block a user