diff --git a/test/test_api/test_api.py b/test/test_api/test_api.py index 23655b44..50fa0ce3 100644 --- a/test/test_api/test_api.py +++ b/test/test_api/test_api.py @@ -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' diff --git a/test/test_api/test_settings.py b/test/test_api/test_settings.py index 43642cd6..522bf82d 100644 --- a/test/test_api/test_settings.py +++ b/test/test_api/test_settings.py @@ -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.') diff --git a/test/test_regression.py b/test/test_regression.py deleted file mode 100644 index a0feb555..00000000 --- a/test/test_regression.py +++ /dev/null @@ -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'])