Merge with master

The deprecation of Python2.6 and the insertion of environments made it quite difficult to merge.
This commit is contained in:
Dave Halter
2018-01-20 18:58:43 +01:00
48 changed files with 205 additions and 210 deletions

View File

@@ -1,7 +1,7 @@
def test_module_attributes(Script):
def_, = Script('__name__').completions()
assert def_.name == '__name__'
assert def_.line == None
assert def_.column == None
assert def_.line is None
assert def_.column is None
str_, = def_._goto_definitions()
assert str_.name == 'str'

View File

@@ -10,8 +10,6 @@ import pytest
from jedi._compatibility import find_module_py33, find_module
from ..helpers import cwd_at
from jedi._compatibility import is_py26
@pytest.mark.skipif('sys.version_info < (3,3)')
def test_find_module_py33():
@@ -163,10 +161,9 @@ def test_complete_on_empty_import(Script):
# relative import
assert 10 < len(Script("from . import classes", 1, 6, 'whatever.py').completions()) < 30
wanted = set(['ImportError', 'import', 'ImportWarning'])
assert set([c.name for c in Script("import").completions()]) == wanted
if not is_py26: # python 2.6 doesn't always come with a library `import*`.
assert len(Script("import import", path='').completions()) > 0
wanted = {'ImportError', 'import', 'ImportWarning'}
assert {c.name for c in Script("import").completions()} == wanted
assert len(Script("import import", path='').completions()) > 0
# 111
assert Script("from datetime import").completions()[0].name == 'import'

View File

@@ -5,7 +5,6 @@ with "Black Box Tests".
from textwrap import dedent
import pytest
from jedi._compatibility import is_py26
# The namedtuple is different for different Python2.7 versions. Some versions
@@ -28,10 +27,7 @@ def test_namedtuple_str(letter, expected, Script):
dave.%s""") % letter
result = Script(source).completions()
completions = set(r.name for r in result)
if is_py26:
assert completions == set()
else:
assert completions == set(expected)
assert completions == set(expected)
def test_namedtuple_list(Script):
@@ -42,10 +38,7 @@ def test_namedtuple_list(Script):
garfield.l""")
result = Script(source).completions()
completions = set(r.name for r in result)
if is_py26:
assert completions == set()
else:
assert completions == set(['legs', 'length', 'large'])
assert completions == {'legs', 'length', 'large'}
def test_namedtuple_content(Script):

View File

@@ -15,9 +15,9 @@ def test_paths_from_assignment(Script):
expr_stmt = script._get_module_node().children[0]
return set(sys_path._paths_from_assignment(script._get_module(), expr_stmt))
assert paths('sys.path[0:0] = ["a"]') == set(['/foo/a'])
assert paths('sys.path = ["b", 1, x + 3, y, "c"]') == set(['/foo/b', '/foo/c'])
assert paths('sys.path = a = ["a"]') == set(['/foo/a'])
assert paths('sys.path[0:0] = ["a"]') == {'/foo/a'}
assert paths('sys.path = ["b", 1, x + 3, y, "c"]') == {'/foo/b', '/foo/c'}
assert paths('sys.path = a = ["a"]') == {'/foo/a'}
# Fail for complicated examples.
assert paths('sys.path, other = ["a"], 2') == set()