mirror of
https://github.com/davidhalter/jedi.git
synced 2026-01-09 21:42:20 +08:00
Get rid of completions in tests
This commit is contained in:
@@ -8,4 +8,4 @@ from .. import helpers
|
||||
@helpers.cwd_at("test/test_inference/absolute_import")
|
||||
def test_can_complete_when_shadowing(Script):
|
||||
script = Script(path="unittest.py")
|
||||
assert script.completions()
|
||||
assert script.complete()
|
||||
|
||||
@@ -83,12 +83,12 @@ def test_method_completion(Script, environment):
|
||||
|
||||
foo = Foo()
|
||||
foo.bar.__func__''')
|
||||
assert [c.name for c in Script(code).completions()] == ['__func__']
|
||||
assert [c.name for c in Script(code).complete()] == ['__func__']
|
||||
|
||||
|
||||
def test_time_docstring(Script):
|
||||
import time
|
||||
comp, = Script('import time\ntime.sleep').completions()
|
||||
comp, = Script('import time\ntime.sleep').complete()
|
||||
assert comp.docstring(raw=True) == time.sleep.__doc__
|
||||
expected = 'sleep(secs: float) -> None\n\n' + time.sleep.__doc__
|
||||
assert comp.docstring() == expected
|
||||
|
||||
@@ -2,7 +2,7 @@ from jedi._compatibility import force_unicode
|
||||
|
||||
|
||||
def test_module_attributes(Script):
|
||||
def_, = Script('__name__').completions()
|
||||
def_, = Script('__name__').complete()
|
||||
assert def_.name == '__name__'
|
||||
assert def_.line is None
|
||||
assert def_.column is None
|
||||
|
||||
@@ -91,7 +91,7 @@ def test_completion(Script):
|
||||
assert Script('''
|
||||
class DocstringCompletion():
|
||||
#? []
|
||||
""" asdfas """''').completions()
|
||||
""" asdfas """''').complete()
|
||||
|
||||
|
||||
def test_docstrings_type_dotted_import(Script):
|
||||
@@ -101,7 +101,7 @@ def test_docstrings_type_dotted_import(Script):
|
||||
:type arg: random.Random
|
||||
'''
|
||||
arg."""
|
||||
names = [c.name for c in Script(s).completions()]
|
||||
names = [c.name for c in Script(s).complete()]
|
||||
assert 'seed' in names
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ def test_docstrings_param_type(Script):
|
||||
:param str arg: some description
|
||||
'''
|
||||
arg."""
|
||||
names = [c.name for c in Script(s).completions()]
|
||||
names = [c.name for c in Script(s).complete()]
|
||||
assert 'join' in names
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ def test_docstrings_type_str(Script):
|
||||
'''
|
||||
arg."""
|
||||
|
||||
names = [c.name for c in Script(s).completions()]
|
||||
names = [c.name for c in Script(s).complete()]
|
||||
assert 'join' in names
|
||||
|
||||
|
||||
@@ -150,14 +150,14 @@ def test_docstring_instance(Script):
|
||||
|
||||
c.""")
|
||||
|
||||
names = [c.name for c in Script(s).completions()]
|
||||
names = [c.name for c in Script(s).complete()]
|
||||
assert 'a' in names
|
||||
assert '__init__' in names
|
||||
assert 'mro' not in names # Exists only for types.
|
||||
|
||||
|
||||
def test_docstring_keyword(Script):
|
||||
completions = Script('assert').completions()
|
||||
completions = Script('assert').complete()
|
||||
assert 'assert' in completions[0].docstring()
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ def test_numpydoc_parameters():
|
||||
y : str
|
||||
"""
|
||||
y.''')
|
||||
names = [c.name for c in jedi.Script(s).completions()]
|
||||
names = [c.name for c in jedi.Script(s).complete()]
|
||||
assert 'isupper' in names
|
||||
assert 'capitalize' in names
|
||||
|
||||
@@ -201,7 +201,7 @@ def test_numpydoc_parameters_set_of_values():
|
||||
x : {'foo', 'bar', 100500}, optional
|
||||
"""
|
||||
x.''')
|
||||
names = [c.name for c in jedi.Script(s).completions()]
|
||||
names = [c.name for c in jedi.Script(s).complete()]
|
||||
assert 'isupper' in names
|
||||
assert 'capitalize' in names
|
||||
assert 'numerator' in names
|
||||
@@ -218,7 +218,7 @@ def test_numpydoc_parameters_alternative_types():
|
||||
x : int or str or list
|
||||
"""
|
||||
x.''')
|
||||
names = [c.name for c in jedi.Script(s).completions()]
|
||||
names = [c.name for c in jedi.Script(s).complete()]
|
||||
assert 'isupper' in names
|
||||
assert 'capitalize' in names
|
||||
assert 'numerator' in names
|
||||
@@ -237,7 +237,7 @@ def test_numpydoc_invalid():
|
||||
"""
|
||||
x.''')
|
||||
|
||||
assert not jedi.Script(s).completions()
|
||||
assert not jedi.Script(s).complete()
|
||||
|
||||
|
||||
@pytest.mark.skipif(numpydoc_unavailable,
|
||||
@@ -256,7 +256,7 @@ def test_numpydoc_returns():
|
||||
def bazbiz():
|
||||
z = foobar()
|
||||
z.''')
|
||||
names = [c.name for c in jedi.Script(s).completions()]
|
||||
names = [c.name for c in jedi.Script(s).complete()]
|
||||
assert 'isupper' in names
|
||||
assert 'capitalize' in names
|
||||
assert 'numerator' in names
|
||||
@@ -277,7 +277,7 @@ def test_numpydoc_returns_set_of_values():
|
||||
def bazbiz():
|
||||
z = foobar()
|
||||
z.''')
|
||||
names = [c.name for c in jedi.Script(s).completions()]
|
||||
names = [c.name for c in jedi.Script(s).complete()]
|
||||
assert 'isupper' in names
|
||||
assert 'capitalize' in names
|
||||
assert 'numerator' in names
|
||||
@@ -298,7 +298,7 @@ def test_numpydoc_returns_alternative_types():
|
||||
def bazbiz():
|
||||
z = foobar()
|
||||
z.''')
|
||||
names = [c.name for c in jedi.Script(s).completions()]
|
||||
names = [c.name for c in jedi.Script(s).complete()]
|
||||
assert 'isupper' not in names
|
||||
assert 'capitalize' not in names
|
||||
assert 'numerator' in names
|
||||
@@ -320,7 +320,7 @@ def test_numpydoc_returns_list_of():
|
||||
def bazbiz():
|
||||
z = foobar()
|
||||
z.''')
|
||||
names = [c.name for c in jedi.Script(s).completions()]
|
||||
names = [c.name for c in jedi.Script(s).complete()]
|
||||
assert 'append' in names
|
||||
assert 'isupper' not in names
|
||||
assert 'capitalize' not in names
|
||||
@@ -342,7 +342,7 @@ def test_numpydoc_returns_obj():
|
||||
z = foobar(x, y)
|
||||
z.''')
|
||||
script = jedi.Script(s)
|
||||
names = [c.name for c in script.completions()]
|
||||
names = [c.name for c in script.complete()]
|
||||
assert 'numerator' in names
|
||||
assert 'seed' in names
|
||||
|
||||
@@ -363,7 +363,7 @@ def test_numpydoc_yields():
|
||||
def bazbiz():
|
||||
z = foobar():
|
||||
z.''')
|
||||
names = [c.name for c in jedi.Script(s).completions()]
|
||||
names = [c.name for c in jedi.Script(s).complete()]
|
||||
assert 'isupper' in names
|
||||
assert 'capitalize' in names
|
||||
assert 'numerator' in names
|
||||
@@ -377,7 +377,7 @@ def test_numpy_returns():
|
||||
x = numpy.asarray([])
|
||||
x.d'''
|
||||
)
|
||||
names = [c.name for c in jedi.Script(s).completions()]
|
||||
names = [c.name for c in jedi.Script(s).complete()]
|
||||
assert 'diagonal' in names
|
||||
|
||||
|
||||
@@ -389,7 +389,7 @@ def test_numpy_comp_returns():
|
||||
x = numpy.array([])
|
||||
x.d'''
|
||||
)
|
||||
names = [c.name for c in jedi.Script(s).completions()]
|
||||
names = [c.name for c in jedi.Script(s).complete()]
|
||||
assert 'diagonal' in names
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import pytest
|
||||
|
||||
def test_completions(Script):
|
||||
s = Script('import _ctypes; _ctypes.')
|
||||
assert len(s.completions()) >= 15
|
||||
assert len(s.complete()) >= 15
|
||||
|
||||
|
||||
def test_call_signatures_extension(Script):
|
||||
@@ -51,7 +51,7 @@ def test_init_extension_module(Script):
|
||||
This is also why this test only runs on certain systems (and Python 3.4).
|
||||
"""
|
||||
s = jedi.Script('import init_extension_module as i\ni.', path='not_existing.py')
|
||||
assert 'foo' in [c.name for c in s.completions()]
|
||||
assert 'foo' in [c.name for c in s.complete()]
|
||||
|
||||
s = jedi.Script('from init_extension_module import foo\nfoo', path='not_existing.py')
|
||||
assert ['foo'] == [c.name for c in s.completions()]
|
||||
assert ['foo'] == [c.name for c in s.complete()]
|
||||
|
||||
@@ -15,5 +15,5 @@ def test_fstring_multiline(Script):
|
||||
'''
|
||||
"""
|
||||
)
|
||||
c, = Script(code, line=2, column=9).completions()
|
||||
c, = Script(code).complete(line=2, column=9)
|
||||
assert c.name == 'upper'
|
||||
|
||||
@@ -124,7 +124,7 @@ def test_sys_getwindowsversion(Script, environment):
|
||||
|
||||
def test_sys_hexversion(Script):
|
||||
script = Script('import sys; sys.hexversion')
|
||||
def_, = script.completions()
|
||||
def_, = script.complete()
|
||||
assert isinstance(def_._name, stub_value._StubName), def_._name
|
||||
assert typeshed.TYPESHED_PATH in def_.module_path
|
||||
def_, = script.goto_definitions()
|
||||
|
||||
@@ -32,7 +32,7 @@ def test_implicit_namespace_package(Script):
|
||||
assert ass[0].description == "foo = '%s'" % solution
|
||||
|
||||
# completion
|
||||
completions = script_with_path('from pkg import ').completions()
|
||||
completions = script_with_path('from pkg import ').complete()
|
||||
names = [c.name for c in completions]
|
||||
compare = ['ns1_file', 'ns2_file']
|
||||
# must at least contain these items, other items are not important
|
||||
@@ -43,7 +43,7 @@ def test_implicit_namespace_package(Script):
|
||||
'from pkg import ns1_file as x': 'ns1_file!'
|
||||
}
|
||||
for source, solution in tests.items():
|
||||
for c in script_with_path(source + '; x.').completions():
|
||||
for c in script_with_path(source + '; x.').complete():
|
||||
if c.name == 'foo':
|
||||
completion = c
|
||||
solution = "foo = '%s'" % solution
|
||||
@@ -72,7 +72,7 @@ def test_implicit_namespace_package_import_autocomplete(Script):
|
||||
sys_path = [dirname(__file__)]
|
||||
|
||||
script = Script(sys_path=sys_path, source=CODE)
|
||||
compl = script.completions()
|
||||
compl = script.complete()
|
||||
assert [c.name for c in compl] == ['implicit_namespace_package']
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ def test_namespace_package_in_multiple_directories_autocompletion(Script):
|
||||
for d in ['implicit_namespace_package/ns1', 'implicit_namespace_package/ns2']]
|
||||
|
||||
script = Script(sys_path=sys_path, source=CODE)
|
||||
compl = script.completions()
|
||||
compl = script.complete()
|
||||
assert set(c.name for c in compl) == set(['ns1_file', 'ns2_file'])
|
||||
|
||||
|
||||
@@ -101,5 +101,5 @@ def test_namespace_name_autocompletion_full_name(Script):
|
||||
for d in ['implicit_namespace_package/ns1', 'implicit_namespace_package/ns2']]
|
||||
|
||||
script = Script(sys_path=sys_path, source=CODE)
|
||||
compl = script.completions()
|
||||
compl = script.complete()
|
||||
assert set(c.full_name for c in compl) == set(['pkg'])
|
||||
|
||||
@@ -46,7 +46,7 @@ pkg_zip_path = os.path.join(os.path.dirname(__file__),
|
||||
def test_find_module_package_zipped(Script, inference_state, environment):
|
||||
sys_path = environment.get_sys_path() + [pkg_zip_path]
|
||||
script = Script('import pkg; pkg.mod', sys_path=sys_path)
|
||||
assert len(script.completions()) == 1
|
||||
assert len(script.complete()) == 1
|
||||
|
||||
file_io, is_package = inference_state.compiled_subprocess.get_module_info(
|
||||
sys_path=sys_path,
|
||||
@@ -100,7 +100,7 @@ def test_find_module_not_package_zipped(Script, inference_state, environment):
|
||||
path = os.path.join(os.path.dirname(__file__), 'zipped_imports/not_pkg.zip')
|
||||
sys_path = environment.get_sys_path() + [path]
|
||||
script = Script('import not_pkg; not_pkg.val', sys_path=sys_path)
|
||||
assert len(script.completions()) == 1
|
||||
assert len(script.complete()) == 1
|
||||
|
||||
file_io, is_package = inference_state.compiled_subprocess.get_module_info(
|
||||
sys_path=sys_path,
|
||||
@@ -145,14 +145,14 @@ def test_flask_ext(Script, code, name):
|
||||
"""flask.ext.foo is really imported from flaskext.foo or flask_foo.
|
||||
"""
|
||||
path = os.path.join(os.path.dirname(__file__), 'flask-site-packages')
|
||||
completions = Script(code, sys_path=[path]).completions()
|
||||
completions = Script(code, sys_path=[path]).complete()
|
||||
assert name in [c.name for c in completions]
|
||||
|
||||
|
||||
@cwd_at('test/test_inference/')
|
||||
def test_not_importable_file(Script):
|
||||
src = 'import not_importable_file as x; x.'
|
||||
assert not Script(src, path='example.py').completions()
|
||||
assert not Script(src, path='example.py').complete()
|
||||
|
||||
|
||||
def test_import_unique(Script):
|
||||
@@ -168,9 +168,9 @@ def test_cache_works_with_sys_path_param(Script, tmpdir):
|
||||
foo_path.join('module.py').write('foo = 123', ensure=True)
|
||||
bar_path.join('module.py').write('bar = 123', ensure=True)
|
||||
foo_completions = Script('import module; module.',
|
||||
sys_path=[foo_path.strpath]).completions()
|
||||
sys_path=[foo_path.strpath]).complete()
|
||||
bar_completions = Script('import module; module.',
|
||||
sys_path=[bar_path.strpath]).completions()
|
||||
sys_path=[bar_path.strpath]).complete()
|
||||
assert 'foo' in [c.name for c in foo_completions]
|
||||
assert 'bar' not in [c.name for c in foo_completions]
|
||||
|
||||
@@ -181,7 +181,7 @@ def test_cache_works_with_sys_path_param(Script, tmpdir):
|
||||
def test_import_completion_docstring(Script):
|
||||
import abc
|
||||
s = Script('"""test"""\nimport ab')
|
||||
abc_completions = [c for c in s.completions() if c.name == 'abc']
|
||||
abc_completions = [c for c in s.complete() if c.name == 'abc']
|
||||
assert len(abc_completions) == 1
|
||||
assert abc_completions[0].docstring(fast=False) == abc.__doc__
|
||||
|
||||
@@ -197,40 +197,40 @@ def test_goto_definition_on_import(Script):
|
||||
|
||||
@cwd_at('jedi')
|
||||
def test_complete_on_empty_import(Script):
|
||||
assert Script("from datetime import").completions()[0].name == 'import'
|
||||
assert Script("from datetime import").complete()[0].name == 'import'
|
||||
# should just list the files in the directory
|
||||
assert 10 < len(Script("from .", path='whatever.py').completions()) < 30
|
||||
assert 10 < len(Script("from .", path='whatever.py').complete()) < 30
|
||||
|
||||
# Global import
|
||||
assert len(Script("from . import", 1, 5, 'whatever.py').completions()) > 30
|
||||
assert len(Script("from . import", 'whatever.py').complete(1, 5)) > 30
|
||||
# relative import
|
||||
assert 10 < len(Script("from . import", 1, 6, 'whatever.py').completions()) < 30
|
||||
assert 10 < len(Script("from . import", 'whatever.py').complete(1, 6)) < 30
|
||||
|
||||
# Global import
|
||||
assert len(Script("from . import classes", 1, 5, 'whatever.py').completions()) > 30
|
||||
assert len(Script("from . import classes", 'whatever.py').complete(1, 5)) > 30
|
||||
# relative import
|
||||
assert 10 < len(Script("from . import classes", 1, 6, 'whatever.py').completions()) < 30
|
||||
assert 10 < len(Script("from . import classes", 'whatever.py').complete(1, 6)) < 30
|
||||
|
||||
wanted = {'ImportError', 'import', 'ImportWarning'}
|
||||
assert {c.name for c in Script("import").completions()} == wanted
|
||||
assert len(Script("import import", path='').completions()) > 0
|
||||
assert {c.name for c in Script("import").complete()} == wanted
|
||||
assert len(Script("import import", path='').complete()) > 0
|
||||
|
||||
# 111
|
||||
assert Script("from datetime import").completions()[0].name == 'import'
|
||||
assert Script("from datetime import ").completions()
|
||||
assert Script("from datetime import").complete()[0].name == 'import'
|
||||
assert Script("from datetime import ").complete()
|
||||
|
||||
|
||||
def test_imports_on_global_namespace_without_path(Script):
|
||||
"""If the path is None, there shouldn't be any import problem"""
|
||||
completions = Script("import operator").completions()
|
||||
completions = Script("import operator").complete()
|
||||
assert [c.name for c in completions] == ['operator']
|
||||
completions = Script("import operator", path='example.py').completions()
|
||||
completions = Script("import operator", path='example.py').complete()
|
||||
assert [c.name for c in completions] == ['operator']
|
||||
|
||||
# the first one has a path the second doesn't
|
||||
completions = Script("import keyword", path='example.py').completions()
|
||||
completions = Script("import keyword", path='example.py').complete()
|
||||
assert [c.name for c in completions] == ['keyword']
|
||||
completions = Script("import keyword").completions()
|
||||
completions = Script("import keyword").complete()
|
||||
assert [c.name for c in completions] == ['keyword']
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@ def test_goto_assignments(Script):
|
||||
|
||||
def test_os_after_from(Script):
|
||||
def check(source, result, column=None):
|
||||
completions = Script(source, column=column).completions()
|
||||
completions = Script(source).complete(column=column)
|
||||
assert [c.name for c in completions] == result
|
||||
|
||||
check('\nfrom os. ', ['path'])
|
||||
@@ -270,7 +270,7 @@ def test_os_after_from(Script):
|
||||
|
||||
def test_os_issues(Script):
|
||||
def import_names(*args, **kwargs):
|
||||
return [d.name for d in Script(*args, **kwargs).completions()]
|
||||
return [d.name for d in Script(*args).complete(**kwargs)]
|
||||
|
||||
# Github issue #759
|
||||
s = 'import os, s'
|
||||
@@ -291,7 +291,7 @@ def test_path_issues(Script):
|
||||
See pull request #684 for details.
|
||||
"""
|
||||
source = '''from datetime import '''
|
||||
assert Script(source).completions()
|
||||
assert Script(source).complete()
|
||||
|
||||
|
||||
def test_compiled_import_none(monkeypatch, Script):
|
||||
@@ -361,7 +361,7 @@ def test_relative_imports_with_multiple_similar_directories(Script, path, empty_
|
||||
path=os.path.join(dir, path),
|
||||
_project=project,
|
||||
)
|
||||
name, import_ = script.completions()
|
||||
name, import_ = script.complete()
|
||||
assert import_.name == 'import'
|
||||
assert name.name == 'api_test1'
|
||||
|
||||
@@ -374,37 +374,37 @@ def test_relative_imports_with_outside_paths(Script):
|
||||
path=os.path.join(dir, 'api/whatever/test_this.py'),
|
||||
_project=project,
|
||||
)
|
||||
assert [c.name for c in script.completions()] == ['api', 'import', 'whatever']
|
||||
assert [c.name for c in script.complete()] == ['api', 'import', 'whatever']
|
||||
|
||||
script = Script(
|
||||
"from " + '.' * 100,
|
||||
path=os.path.join(dir, 'api/whatever/test_this.py'),
|
||||
_project=project,
|
||||
)
|
||||
assert [c.name for c in script.completions()] == ['import']
|
||||
assert [c.name for c in script.complete()] == ['import']
|
||||
|
||||
|
||||
@cwd_at('test/examples/issue1209/api/whatever/')
|
||||
def test_relative_imports_without_path(Script):
|
||||
project = Project('.', sys_path=[], smart_sys_path=False)
|
||||
script = Script("from . ", _project=project)
|
||||
assert [c.name for c in script.completions()] == ['api_test1', 'import']
|
||||
assert [c.name for c in script.complete()] == ['api_test1', 'import']
|
||||
|
||||
script = Script("from .. ", _project=project)
|
||||
assert [c.name for c in script.completions()] == ['import', 'whatever']
|
||||
assert [c.name for c in script.complete()] == ['import', 'whatever']
|
||||
|
||||
script = Script("from ... ", _project=project)
|
||||
assert [c.name for c in script.completions()] == ['api', 'import', 'whatever']
|
||||
assert [c.name for c in script.complete()] == ['api', 'import', 'whatever']
|
||||
|
||||
|
||||
def test_relative_import_out_of_file_system(Script):
|
||||
script = Script("from " + '.' * 100)
|
||||
import_, = script.completions()
|
||||
import_, = script.complete()
|
||||
assert import_.name == 'import'
|
||||
|
||||
script = Script("from " + '.' * 100 + 'abc import ABCMeta')
|
||||
assert not script.goto_definitions()
|
||||
assert not script.completions()
|
||||
assert not script.complete()
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@@ -462,7 +462,7 @@ def test_import_needed_modules_by_jedi(Script, environment, tmpdir, name):
|
||||
|
||||
|
||||
def test_import_with_semicolon(Script):
|
||||
names = [c.name for c in Script('xzy; from abc import ').completions()]
|
||||
names = [c.name for c in Script('xzy; from abc import ').complete()]
|
||||
assert 'ABCMeta' in names
|
||||
assert 'abc' not in names
|
||||
|
||||
@@ -475,6 +475,6 @@ def test_relative_import_star(Script):
|
||||
from . import *
|
||||
furl.c
|
||||
"""
|
||||
script = jedi.Script(source, 3, len("furl.c"), 'export.py')
|
||||
script = jedi.Script(source, 'export.py')
|
||||
|
||||
assert script.completions()
|
||||
assert script.complete(3, len("furl.c"))
|
||||
|
||||
@@ -39,4 +39,4 @@ def test_generics():
|
||||
self.stack.push(1)
|
||||
|
||||
s = StackWrapper()
|
||||
print(interpreter('s.stack.pop().', locals()).completions())
|
||||
print(interpreter('s.stack.pop().', locals()).complete())
|
||||
|
||||
@@ -38,7 +38,7 @@ def test_goto_assignment(Script, source, solution):
|
||||
|
||||
def test_simple_completions(Script):
|
||||
# completion
|
||||
completions = script_with_path(Script, 'from pkg import ').completions()
|
||||
completions = script_with_path(Script, 'from pkg import ').complete()
|
||||
names = [str(c.name) for c in completions] # str because of unicode
|
||||
compare = ['foo', 'ns1_file', 'ns1_folder', 'ns2_folder', 'ns2_file',
|
||||
'pkg_resources', 'pkgutil', '__name__', '__path__',
|
||||
@@ -58,7 +58,7 @@ def test_simple_completions(Script):
|
||||
]
|
||||
)
|
||||
def test_completions(Script, source, solution):
|
||||
for c in script_with_path(Script, source + '; x.').completions():
|
||||
for c in script_with_path(Script, source + '; x.').complete():
|
||||
if c.name == 'foo':
|
||||
completion = c
|
||||
solution = "foo = '%s'" % solution
|
||||
|
||||
@@ -70,4 +70,4 @@ def test_pyc(pyc_project_path, environment):
|
||||
"from dummy_package import dummy; dummy.",
|
||||
path=path,
|
||||
environment=environment)
|
||||
assert len(s.completions()) >= 2
|
||||
assert len(s.complete()) >= 2
|
||||
|
||||
@@ -17,7 +17,7 @@ def test_namedtuple_str(letter, expected, Script):
|
||||
Person = collections.namedtuple('Person', 'name smart')
|
||||
dave = Person('Dave', False)
|
||||
dave.%s""") % letter
|
||||
result = Script(source).completions()
|
||||
result = Script(source).complete()
|
||||
completions = set(r.name for r in result)
|
||||
assert completions == set(expected)
|
||||
|
||||
@@ -28,7 +28,7 @@ def test_namedtuple_list(Script):
|
||||
Cat = collections.namedtuple('Person', ['legs', u'length', 'large'])
|
||||
garfield = Cat(4, '85cm', True)
|
||||
garfield.l""")
|
||||
result = Script(source).completions()
|
||||
result = Script(source).complete()
|
||||
completions = set(r.name for r in result)
|
||||
assert completions == {'legs', 'length', 'large'}
|
||||
|
||||
@@ -62,7 +62,7 @@ def test_nested_namedtuples(Script):
|
||||
train_x = Datasets(train=Dataset('data_value'))
|
||||
train_x.train.'''
|
||||
))
|
||||
assert 'data' in [c.name for c in s.completions()]
|
||||
assert 'data' in [c.name for c in s.complete()]
|
||||
|
||||
|
||||
def test_namedtuple_goto_definitions(Script):
|
||||
|
||||
Reference in New Issue
Block a user