Move the last test out of test_regressions and delete the file

This also deletes a test that probably has become useful because the issue it tested was caused by code that doesn't exist anymore
This commit is contained in:
Dave Halter
2017-12-29 20:34:52 +01:00
parent 01ffd2f981
commit 68381e09c9
3 changed files with 13 additions and 51 deletions

View File

@@ -273,3 +273,15 @@ def test_no_statement_parent(Script):
defs = Script(source, column=3).goto_definitions()
defs = sorted(defs, key=lambda d: d.line)
assert [d.description for d in defs] == ['def f', 'class C']
def test_backslash_continuation_and_bracket(Script):
code = dedent(r"""
x = 0
a = \
[1, 2, 3, (x)]""")
lines = code.splitlines()
column = lines[-1].index('(')
def_, = Script(code, line=len(lines), column=column).goto_definitions()
assert def_.name == 'int'

View File

@@ -4,7 +4,7 @@ import pytest
from jedi import api
from jedi.evaluate import imports
from .helpers import cwd_at
from ..helpers import cwd_at
@pytest.mark.skipif('True', reason='Skip for now, test case is not really supported.')

View File

@@ -1,50 +0,0 @@
"""
Unit tests to avoid errors of the past. These are also all tests that didn't
found a good place in any other testing module.
"""
import textwrap
def check_definition_by_marker(Script, 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 = Script(source, i + 1, column).goto_definitions()
assert [d.name for d in defs] == names
def test_backslash_continuation(Script):
"""
Test that ModuleWithCursor.get_path_until_cursor handles continuation
"""
check_definition_by_marker(Script, r"""
x = 0
a = \
[1, 2, 3, 4, 5, 6, 7, 8, 9, x] # <-- here
""", '] # <-- here', ['int'])
# completion in whitespace
s = 'asdfxyxxxxxxxx sds\\\n hello'
assert Script(s, 2, 4).goto_assignments() == []
def test_backslash_continuation_and_bracket(Script):
check_definition_by_marker(Script, r"""
x = 0
a = \
[1, 2, 3, 4, 5, 6, 7, 8, 9, (x)] # <-- here
""", '(x)] # <-- here', ['int'])