mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 05:54:25 +08:00
Get rid of completions in tests
This commit is contained in:
@@ -8,18 +8,18 @@ from jedi._compatibility import u, unicode
|
||||
def test_unicode_script(Script):
|
||||
""" normally no unicode objects are being used. (<=2.7) """
|
||||
s = unicode("import datetime; datetime.timedelta")
|
||||
completions = Script(s).completions()
|
||||
completions = Script(s).complete()
|
||||
assert len(completions)
|
||||
assert type(completions[0].description) is unicode
|
||||
|
||||
s = u("author='öä'; author")
|
||||
completions = Script(s).completions()
|
||||
completions = Script(s).complete()
|
||||
x = completions[0].description
|
||||
assert type(x) is unicode
|
||||
|
||||
s = u("#-*- coding: iso-8859-1 -*-\nauthor='öä'; author")
|
||||
s = s.encode('latin-1')
|
||||
completions = Script(s).completions()
|
||||
completions = Script(s).complete()
|
||||
assert type(completions[0].description) is unicode
|
||||
|
||||
|
||||
@@ -27,11 +27,11 @@ def test_unicode_attribute(Script):
|
||||
""" github jedi-vim issue #94 """
|
||||
s1 = u('#-*- coding: utf-8 -*-\nclass Person():\n'
|
||||
' name = "e"\n\nPerson().name.')
|
||||
completions1 = Script(s1).completions()
|
||||
completions1 = Script(s1).complete()
|
||||
assert 'strip' in [c.name for c in completions1]
|
||||
s2 = u('#-*- coding: utf-8 -*-\nclass Person():\n'
|
||||
' name = "é"\n\nPerson().name.')
|
||||
completions2 = Script(s2).completions()
|
||||
completions2 = Script(s2).complete()
|
||||
assert 'strip' in [c.name for c in completions2]
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ def test_multibyte_script(Script):
|
||||
except NameError:
|
||||
pass # python 3 has no unicode method
|
||||
else:
|
||||
assert len(Script(s, 1, len(code)).completions())
|
||||
assert len(Script(s).complete(1, len(code)))
|
||||
|
||||
|
||||
def test_goto_definition_at_zero(Script):
|
||||
@@ -57,11 +57,11 @@ def test_goto_definition_at_zero(Script):
|
||||
|
||||
|
||||
def test_complete_at_zero(Script):
|
||||
s = Script("str", 1, 3).completions()
|
||||
s = Script("str").complete(1, 3)
|
||||
assert len(s) == 1
|
||||
assert list(s)[0].name == 'str'
|
||||
|
||||
s = Script("", 1, 0).completions()
|
||||
s = Script("").complete(1, 0)
|
||||
assert len(s) > 0
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ def test_wrong_encoding(Script, tmpdir):
|
||||
# Use both latin-1 and utf-8 (a really broken file).
|
||||
x.write_binary(u'foobar = 1\nä'.encode('latin-1') + u'ä'.encode('utf-8'))
|
||||
|
||||
c, = Script('import x; x.foo', sys_path=[tmpdir.strpath]).completions()
|
||||
c, = Script('import x; x.foo', sys_path=[tmpdir.strpath]).complete()
|
||||
assert c.name == 'foobar'
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user