forked from VimPlug/jedi
Drop support for EOL Python 2.6
This commit is contained in:
@@ -403,8 +403,6 @@ def test_func():
|
||||
x
|
||||
|
||||
|
||||
# python >= 2.7
|
||||
# Set literals are not valid in 2.6.
|
||||
#? int()
|
||||
tuple({1})[0]
|
||||
|
||||
|
||||
@@ -286,8 +286,6 @@ with open('') as f:
|
||||
#? str()
|
||||
line
|
||||
|
||||
# Nested with statements don't exist in Python 2.6.
|
||||
# python >= 2.7
|
||||
with open('') as f1, open('') as f2:
|
||||
#? ['closed']
|
||||
f1.closed
|
||||
|
||||
@@ -210,6 +210,5 @@ d[2]
|
||||
next(iter({a for a in range(10)}))
|
||||
|
||||
|
||||
# with a set literal (also doesn't work in 2.6).
|
||||
#? int()
|
||||
[a for a in {1, 2, 3}][0]
|
||||
|
||||
@@ -288,8 +288,6 @@ third()[0]
|
||||
# -----------------
|
||||
# set.add
|
||||
# -----------------
|
||||
# Set literals are not valid in 2.6.
|
||||
# python >= 2.7
|
||||
st = {1.0}
|
||||
for a in [1,2]:
|
||||
st.add(a)
|
||||
|
||||
@@ -47,10 +47,6 @@ b
|
||||
class Employee:
|
||||
pass
|
||||
|
||||
# The typing library is not installable for Python 2.6, therefore ignore the
|
||||
# following tests.
|
||||
# python >= 2.7
|
||||
|
||||
from typing import List
|
||||
x = [] # type: List[Employee]
|
||||
#? Employee()
|
||||
|
||||
@@ -3,8 +3,6 @@ Test the typing library, with docstrings. This is needed since annotations
|
||||
are not supported in python 2.7 else then annotating by comment (and this is
|
||||
still TODO at 2016-01-23)
|
||||
"""
|
||||
# There's no Python 2.6 typing module.
|
||||
# python >= 2.7
|
||||
import typing
|
||||
class B:
|
||||
pass
|
||||
|
||||
@@ -116,8 +116,6 @@ tup4.index
|
||||
# -----------------
|
||||
# set
|
||||
# -----------------
|
||||
# Set literals are not valid in 2.6.
|
||||
# python >= 2.7
|
||||
set_t = {1,2}
|
||||
|
||||
#? ['clear', 'copy']
|
||||
|
||||
@@ -296,8 +296,6 @@ x = 32
|
||||
[x for x in something]
|
||||
|
||||
x = 3
|
||||
# Not supported syntax in Python 2.6.
|
||||
# python >= 2.7
|
||||
#< 1 (0,1), (0,10)
|
||||
{x:1 for x in something}
|
||||
#< 10 (0,1), (0,10)
|
||||
|
||||
@@ -13,7 +13,6 @@ from jedi._compatibility import find_module_py33, find_module
|
||||
from ..helpers import cwd_at
|
||||
|
||||
from jedi import Script
|
||||
from jedi._compatibility import is_py26
|
||||
|
||||
|
||||
@pytest.mark.skipif('sys.version_info < (3,3)')
|
||||
@@ -47,7 +46,6 @@ def test_find_module_package_zipped():
|
||||
assert len(jedi.Script('import pkg; pkg.mod', 1, 19).completions()) == 1
|
||||
|
||||
|
||||
@pytest.mark.skipif('sys.version_info < (2,7)')
|
||||
def test_find_module_not_package_zipped():
|
||||
if 'zipped_imports/not_pkg.zip' not in sys.path:
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__),
|
||||
@@ -160,8 +158,7 @@ def test_complete_on_empty_import():
|
||||
|
||||
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
|
||||
assert len(Script("import import", path='').completions()) > 0
|
||||
|
||||
# 111
|
||||
assert Script("from datetime import").completions()[0].name == 'import'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import pytest
|
||||
|
||||
import jedi
|
||||
from jedi._compatibility import py_version, unicode
|
||||
from jedi._compatibility import py_version
|
||||
|
||||
|
||||
def _eval_literal(code):
|
||||
|
||||
@@ -45,20 +45,5 @@ def generate_pyc():
|
||||
shutil.copy(os.path.join("dummy_package/__pycache__", f), dst)
|
||||
|
||||
|
||||
# Python 2.6 does not necessarily come with `compileall.compile_file`.
|
||||
@pytest.mark.skipif("sys.version_info > (2,6)")
|
||||
@cwd_at('test/test_evaluate')
|
||||
def test_pyc():
|
||||
"""
|
||||
The list of completion must be greater than 2.
|
||||
"""
|
||||
try:
|
||||
generate_pyc()
|
||||
s = jedi.Script("from dummy_package import dummy; dummy.", path='blub.py')
|
||||
assert len(s.completions()) >= 2
|
||||
finally:
|
||||
shutil.rmtree("dummy_package")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_pyc()
|
||||
|
||||
@@ -6,7 +6,6 @@ from textwrap import dedent
|
||||
|
||||
import pytest
|
||||
from jedi import Script
|
||||
from jedi._compatibility import is_py26
|
||||
|
||||
# The namedtuple is different for different Python2.7 versions. Some versions
|
||||
# are missing the attribute `_class_template`.
|
||||
@@ -25,10 +24,7 @@ def test_namedtuple_str(letter, expected):
|
||||
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():
|
||||
@@ -39,10 +35,7 @@ def test_namedtuple_list():
|
||||
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 == set(['legs', 'length', 'large'])
|
||||
|
||||
|
||||
def test_namedtuple_content():
|
||||
|
||||
Reference in New Issue
Block a user