mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 05:54:25 +08:00
Remove is_py3 and is_py35
This commit is contained in:
10
test/run.py
10
test/run.py
@@ -114,7 +114,7 @@ import pytest
|
||||
|
||||
import jedi
|
||||
from jedi import debug
|
||||
from jedi._compatibility import unicode, is_py3
|
||||
from jedi._compatibility import unicode
|
||||
from jedi.api.classes import Name
|
||||
from jedi.api.completion import get_user_context
|
||||
from jedi import parser_utils
|
||||
@@ -401,12 +401,8 @@ def collect_dir_tests(base_dir, test_files, check_thirdparty=False):
|
||||
|
||||
path = os.path.join(base_dir, f_name)
|
||||
|
||||
if is_py3:
|
||||
with open(path, encoding='utf-8', newline='') as f:
|
||||
source = f.read()
|
||||
else:
|
||||
with open(path) as f:
|
||||
source = unicode(f.read(), 'UTF-8')
|
||||
with open(path, encoding='utf-8', newline='') as f:
|
||||
source = f.read()
|
||||
|
||||
for case in collect_file_tests(path, StringIO(source),
|
||||
lines_to_execute):
|
||||
|
||||
@@ -7,7 +7,7 @@ import warnings
|
||||
import pytest
|
||||
|
||||
import jedi
|
||||
from jedi._compatibility import is_py3, py_version
|
||||
from jedi._compatibility import py_version
|
||||
from jedi.inference.compiled import mixed
|
||||
from importlib import import_module
|
||||
|
||||
@@ -139,9 +139,7 @@ def test_complete_raw_module():
|
||||
def test_complete_raw_instance():
|
||||
import datetime
|
||||
dt = datetime.datetime(2013, 1, 1)
|
||||
completions = ['time', 'timetz', 'timetuple']
|
||||
if is_py3:
|
||||
completions += ['timestamp']
|
||||
completions = ['time', 'timetz', 'timetuple', 'timestamp']
|
||||
_assert_interpreter_complete('(dt - dt).ti', locals(), completions)
|
||||
|
||||
|
||||
@@ -349,12 +347,10 @@ def test_keyword_argument():
|
||||
assert c.name == 'some_keyword_argument='
|
||||
assert c.complete == 'ord_argument='
|
||||
|
||||
# This needs inspect.signature to work.
|
||||
if is_py3:
|
||||
# Make it impossible for jedi to find the source of the function.
|
||||
f.__name__ = 'xSOMETHING'
|
||||
c, = jedi.Interpreter("x(some_keyw", [{'x': f}]).complete()
|
||||
assert c.name == 'some_keyword_argument='
|
||||
# Make it impossible for jedi to find the source of the function.
|
||||
f.__name__ = 'xSOMETHING'
|
||||
c, = jedi.Interpreter("x(some_keyw", [{'x': f}]).complete()
|
||||
assert c.name == 'some_keyword_argument='
|
||||
|
||||
|
||||
def test_more_complex_instances():
|
||||
@@ -403,16 +399,12 @@ def test_dir_magic_method(allow_unsafe_getattr):
|
||||
raise AttributeError(name)
|
||||
|
||||
def __dir__(self):
|
||||
if is_py3:
|
||||
names = object.__dir__(self)
|
||||
else:
|
||||
names = dir(object())
|
||||
return ['foo', 'bar'] + names
|
||||
return ['foo', 'bar'] + object.__dir__(self)
|
||||
|
||||
itp = jedi.Interpreter("ca.", [{'ca': CompleteAttrs()}])
|
||||
completions = itp.complete()
|
||||
names = [c.name for c in completions]
|
||||
assert ('__dir__' in names) == is_py3
|
||||
assert ('__dir__' in names) is True
|
||||
assert '__class__' in names
|
||||
assert 'foo' in names
|
||||
assert 'bar' in names
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from jedi._compatibility import is_py3
|
||||
from jedi import parser_utils
|
||||
from parso import parse
|
||||
from parso.python import tree
|
||||
@@ -55,10 +54,7 @@ def test_hex_values_in_docstring():
|
||||
'''
|
||||
|
||||
doc = parser_utils.clean_scope_docstring(next(parse(source).iter_funcdefs()))
|
||||
if is_py3:
|
||||
assert doc == '\xff'
|
||||
else:
|
||||
assert doc == u'<EFBFBD>'
|
||||
assert doc == '\xff'
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
||||
Reference in New Issue
Block a user