1
0
forked from VimPlug/jedi

Get rid of deprecations in tests

This commit is contained in:
Dave Halter
2020-03-21 02:07:53 +01:00
parent 4c964ae655
commit d6d9286242
10 changed files with 40 additions and 27 deletions

View File

@@ -58,9 +58,9 @@ def test_implicit_nested_namespace_package(Script):
code = 'from implicit_nested_namespaces.namespace.pkg.module import CONST'
project = Project('.', sys_path=[example_dir])
script = Script(project=project, source=code, line=1, column=61)
script = Script(code, project=project)
result = script.infer()
result = script.infer(line=1, column=61)
assert len(result) == 1
@@ -70,41 +70,41 @@ def test_implicit_nested_namespace_package(Script):
def test_implicit_namespace_package_import_autocomplete(Script):
CODE = 'from implicit_name'
code = 'from implicit_name'
project = Project('.', sys_path=[example_dir])
script = Script(project=project, source=CODE)
script = Script(code, project=project)
compl = script.complete()
assert [c.name for c in compl] == ['implicit_namespace_package']
def test_namespace_package_in_multiple_directories_autocompletion(Script):
CODE = 'from pkg.'
code = 'from pkg.'
sys_path = [get_example_dir('implicit_namespace_package', 'ns1'),
get_example_dir('implicit_namespace_package', 'ns2')]
project = Project('.', sys_path=sys_path)
script = Script(project=project, source=CODE)
script = Script(code, project=project)
compl = script.complete()
assert set(c.name for c in compl) == set(['ns1_file', 'ns2_file'])
def test_namespace_package_in_multiple_directories_goto_definition(Script):
CODE = 'from pkg import ns1_file'
code = 'from pkg import ns1_file'
sys_path = [get_example_dir('implicit_namespace_package', 'ns1'),
get_example_dir('implicit_namespace_package', 'ns2')]
project = Project('.', sys_path=sys_path)
script = Script(project=project, source=CODE)
script = Script(code, project=project)
result = script.infer()
assert len(result) == 1
def test_namespace_name_autocompletion_full_name(Script):
CODE = 'from pk'
code = 'from pk'
sys_path = [get_example_dir('implicit_namespace_package', 'ns1'),
get_example_dir('implicit_namespace_package', 'ns2')]
project = Project('.', sys_path=sys_path)
script = Script(project=project, source=CODE)
script = Script(code, project=project)
compl = script.complete()
assert set(c.full_name for c in compl) == set(['pkg'])

View File

@@ -259,7 +259,7 @@ def test_goto_following_on_imports(Script):
def test_goto(Script):
sys, = Script("import sys", 1, 10).goto(follow_imports=True)
sys, = Script("import sys").goto(follow_imports=True)
assert sys.type == 'module'
@@ -472,6 +472,6 @@ def test_relative_import_star(Script):
from . import *
furl.c
"""
script = Script(source, 'export.py')
script = Script(source, path='export.py')
assert script.complete(3, len("furl.c"))

View File

@@ -71,9 +71,7 @@ def test_nested_namespace_package(Script):
sys_path = [example_dir]
project = Project('.', sys_path=sys_path)
script = Script(project=project, source=code)
result = script.infer(line=1, column=45)
result = Script(code, project=project).infer(line=1, column=45)
assert len(result) == 1