mirror of
https://github.com/davidhalter/jedi.git
synced 2026-01-30 19:25:22 +08:00
parent_value -> parent_context
This commit is contained in:
@@ -122,7 +122,7 @@ def _return_int():
|
||||
('ret_int', '_return_int', 'test.test_inference.test_compiled'),
|
||||
]
|
||||
)
|
||||
def test_parent_value(same_process_infer_state, attribute, expected_name, expected_parent):
|
||||
def test_parent_context(same_process_infer_state, attribute, expected_name, expected_parent):
|
||||
import decimal
|
||||
|
||||
class C:
|
||||
@@ -140,11 +140,11 @@ def test_parent_value(same_process_infer_state, attribute, expected_name, expect
|
||||
)
|
||||
x, = o.py__getattribute__(attribute)
|
||||
assert x.py__name__() == expected_name
|
||||
module_name = x.parent_value.py__name__()
|
||||
module_name = x.parent_context.py__name__()
|
||||
if module_name == '__builtin__':
|
||||
module_name = 'builtins' # Python 2
|
||||
assert module_name == expected_parent
|
||||
assert x.parent_value.parent_value is None
|
||||
assert x.parent_context.parent_context is None
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Ignore Python 2, because EOL")
|
||||
|
||||
@@ -156,8 +156,8 @@ def test_not_importable_file(Script):
|
||||
def test_import_unique(Script):
|
||||
src = "import os; os.path"
|
||||
defs = Script(src, path='example.py').goto_definitions()
|
||||
parent_values = [d._name._value for d in defs]
|
||||
assert len(parent_values) == len(set(parent_values))
|
||||
parent_contexts = [d._name._value for d in defs]
|
||||
assert len(parent_contexts) == len(set(parent_contexts))
|
||||
|
||||
|
||||
def test_cache_works_with_sys_path_param(Script, tmpdir):
|
||||
|
||||
@@ -15,7 +15,7 @@ def test_base_auto_import_modules(auto_import_json, Script):
|
||||
loads, = Script('import json; json.loads').goto_definitions()
|
||||
assert isinstance(loads._name, ValueName)
|
||||
value, = loads._name.infer()
|
||||
assert isinstance(value.parent_value, StubModuleValue)
|
||||
assert isinstance(value.parent_context, StubModuleValue)
|
||||
|
||||
|
||||
def test_auto_import_modules_imports(auto_import_json, Script):
|
||||
|
||||
Reference in New Issue
Block a user