parent_value -> parent_context

This commit is contained in:
Dave Halter
2019-08-15 09:36:46 +02:00
parent 2e90e3b2b1
commit 600272366f
25 changed files with 181 additions and 181 deletions

View File

@@ -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")

View File

@@ -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):

View File

@@ -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):