mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 23:34:45 +08:00
Change some tests in Python2
This commit is contained in:
@@ -18,7 +18,7 @@ def check_follow_definition_types(Script, source):
|
||||
return [d.type for d in defs]
|
||||
|
||||
|
||||
def test_follow_import_incomplete(Script):
|
||||
def test_follow_import_incomplete(Script, environment):
|
||||
"""
|
||||
Completion on incomplete imports should always take the full completion
|
||||
to do any evaluation.
|
||||
@@ -34,8 +34,10 @@ def test_follow_import_incomplete(Script):
|
||||
|
||||
# incomplete `from * import` part
|
||||
datetime = check_follow_definition_types(Script, "from datetime import datetim")
|
||||
assert set(datetime) == {'class', 'instance'} # py33: builtin and pure py version
|
||||
|
||||
if environment.version_info.major == 2:
|
||||
assert datetime == ['class']
|
||||
else:
|
||||
assert set(datetime) == {'class', 'instance'} # py3: builtin and pure py version
|
||||
# os.path check
|
||||
ospath = check_follow_definition_types(Script, "from os.path import abspat")
|
||||
assert ospath == ['function']
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
from textwrap import dedent
|
||||
|
||||
import pytest
|
||||
|
||||
from jedi.evaluate import compiled
|
||||
from jedi.evaluate.helpers import execute_evaluated
|
||||
|
||||
@@ -85,5 +87,8 @@ def test_time_docstring(Script):
|
||||
assert comp.docstring() == expected
|
||||
|
||||
|
||||
def test_dict_values(Script):
|
||||
def test_dict_values(Script, environment):
|
||||
if environment.version_info.major == 2:
|
||||
# It looks like typeshed for Python 2 returns Any.
|
||||
pytest.skip()
|
||||
assert Script('import sys\nsys.modules["alshdb;lasdhf"]').goto_definitions()
|
||||
|
||||
Reference in New Issue
Block a user