forked from VimPlug/jedi
Context -> Value
This commit is contained in:
@@ -8,7 +8,7 @@ import pytest
|
||||
|
||||
import jedi
|
||||
from jedi import __doc__ as jedi_doc
|
||||
from jedi.inference.compiled import CompiledContextName
|
||||
from jedi.inference.compiled import CompiledValueName
|
||||
|
||||
|
||||
def test_is_keyword(Script):
|
||||
@@ -436,7 +436,7 @@ def test_builtin_module_with_path(Script):
|
||||
confusing.
|
||||
"""
|
||||
semlock, = Script('from _multiprocessing import SemLock').goto_definitions()
|
||||
assert isinstance(semlock._name, CompiledContextName)
|
||||
assert isinstance(semlock._name, CompiledValueName)
|
||||
assert semlock.module_path is None
|
||||
assert semlock.in_builtin_module() is True
|
||||
assert semlock.name == 'SemLock'
|
||||
|
||||
@@ -4,8 +4,8 @@ import pytest
|
||||
from parso.utils import PythonVersionInfo
|
||||
|
||||
from jedi.inference.gradual import typeshed, stub_value
|
||||
from jedi.inference.value import TreeInstance, BoundMethod, FunctionContext, \
|
||||
MethodContext, ClassContext
|
||||
from jedi.inference.value import TreeInstance, BoundMethod, FunctionValue, \
|
||||
MethodValue, ClassValue
|
||||
|
||||
TYPESHED_PYTHON3 = os.path.join(typeshed.TYPESHED_PATH, 'stdlib', '3')
|
||||
|
||||
@@ -48,14 +48,14 @@ def test_function(Script, environment):
|
||||
code = 'import threading; threading.current_thread'
|
||||
def_, = Script(code).goto_definitions()
|
||||
value = def_._name._value
|
||||
assert isinstance(value, FunctionContext), value
|
||||
assert isinstance(value, FunctionValue), value
|
||||
|
||||
def_, = Script(code + '()').goto_definitions()
|
||||
value = def_._name._value
|
||||
assert isinstance(value, TreeInstance)
|
||||
|
||||
def_, = Script('import threading; threading.Thread').goto_definitions()
|
||||
assert isinstance(def_._name._value, ClassContext), def_
|
||||
assert isinstance(def_._name._value, ClassValue), def_
|
||||
|
||||
|
||||
def test_keywords_variable(Script):
|
||||
@@ -70,7 +70,7 @@ def test_keywords_variable(Script):
|
||||
def test_class(Script):
|
||||
def_, = Script('import threading; threading.Thread').goto_definitions()
|
||||
value = def_._name._value
|
||||
assert isinstance(value, ClassContext), value
|
||||
assert isinstance(value, ClassValue), value
|
||||
|
||||
|
||||
def test_instance(Script):
|
||||
@@ -82,7 +82,7 @@ def test_instance(Script):
|
||||
def test_class_function(Script):
|
||||
def_, = Script('import threading; threading.Thread.getName').goto_definitions()
|
||||
value = def_._name._value
|
||||
assert isinstance(value, MethodContext), value
|
||||
assert isinstance(value, MethodValue), value
|
||||
|
||||
|
||||
def test_method(Script):
|
||||
@@ -90,7 +90,7 @@ def test_method(Script):
|
||||
def_, = Script(code).goto_definitions()
|
||||
value = def_._name._value
|
||||
assert isinstance(value, BoundMethod), value
|
||||
assert isinstance(value._wrapped_value, MethodContext), value
|
||||
assert isinstance(value._wrapped_value, MethodValue), value
|
||||
|
||||
def_, = Script(code + '()').goto_definitions()
|
||||
value = def_._name._value
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import pytest
|
||||
|
||||
from jedi import settings
|
||||
from jedi.inference.names import ContextName
|
||||
from jedi.inference.compiled import CompiledContextName
|
||||
from jedi.inference.gradual.typeshed import StubModuleContext
|
||||
from jedi.inference.names import ValueName
|
||||
from jedi.inference.compiled import CompiledValueName
|
||||
from jedi.inference.gradual.typeshed import StubModuleValue
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
@@ -13,14 +13,14 @@ def auto_import_json(monkeypatch):
|
||||
|
||||
def test_base_auto_import_modules(auto_import_json, Script):
|
||||
loads, = Script('import json; json.loads').goto_definitions()
|
||||
assert isinstance(loads._name, ContextName)
|
||||
assert isinstance(loads._name, ValueName)
|
||||
value, = loads._name.infer()
|
||||
assert isinstance(value.parent_value, StubModuleContext)
|
||||
assert isinstance(value.parent_value, StubModuleValue)
|
||||
|
||||
|
||||
def test_auto_import_modules_imports(auto_import_json, Script):
|
||||
main, = Script('from json import tool; tool.main').goto_definitions()
|
||||
assert isinstance(main._name, CompiledContextName)
|
||||
assert isinstance(main._name, CompiledValueName)
|
||||
|
||||
|
||||
def test_additional_dynamic_modules(monkeypatch, Script):
|
||||
|
||||
Reference in New Issue
Block a user