diff --git a/test/test_api/test_api.py b/test/test_api/test_api.py index 506d03be..44018e65 100644 --- a/test/test_api/test_api.py +++ b/test/test_api/test_api.py @@ -216,7 +216,7 @@ def test_goto_assignments_follow_imports(Script): definition, = script.goto_assignments(follow_imports=True) assert (definition.line, definition.column) == start_pos assert definition.name == 'p' - result, = definition.goto_assignments() + result, = definition.goto() assert result.name == 'p' result, = definition.infer() assert result.name == 'int' diff --git a/test/test_api/test_classes.py b/test/test_api/test_classes.py index 086eceab..b79bed2e 100644 --- a/test/test_api/test_classes.py +++ b/test/test_api/test_classes.py @@ -340,7 +340,7 @@ def test_goto_assignment_repetition(names): # definition. for _ in range(3): assert len(defs) == 1 - ass = defs[0].goto_assignments() + ass = defs[0].goto() assert ass[0].description == 'a = 1' @@ -351,7 +351,7 @@ def test_goto_assignments_named_params(names): foo(bar=1) """ bar = names(dedent(src), references=True)[-1] - param = bar.goto_assignments()[0] + param = bar.goto()[0] assert (param.line, param.column) == (1, 13) assert param.type == 'param' @@ -360,46 +360,46 @@ def test_class_call(names): src = 'from threading import Thread; Thread(group=1)' n = names(src, references=True)[-1] assert n.name == 'group' - param_def = n.goto_assignments()[0] + param_def = n.goto()[0] assert param_def.name == 'group' assert param_def.type == 'param' def test_parentheses(names): n = names('("").upper', references=True)[-1] - assert n.goto_assignments()[0].name == 'upper' + assert n.goto()[0].name == 'upper' def test_import(names): nms = names('from json import load', references=True) assert nms[0].name == 'json' assert nms[0].type == 'module' - n = nms[0].goto_assignments()[0] + n = nms[0].goto()[0] assert n.name == 'json' assert n.type == 'module' assert nms[1].name == 'load' assert nms[1].type == 'function' - n = nms[1].goto_assignments()[0] + n = nms[1].goto()[0] assert n.name == 'load' assert n.type == 'function' nms = names('import os; os.path', references=True) assert nms[0].name == 'os' assert nms[0].type == 'module' - n = nms[0].goto_assignments()[0] + n = nms[0].goto()[0] assert n.name == 'os' assert n.type == 'module' - n = nms[2].goto_assignments()[0] + n = nms[2].goto()[0] assert n.name == 'path' assert n.type == 'module' nms = names('import os.path', references=True) - n = nms[0].goto_assignments()[0] + n = nms[0].goto()[0] assert n.name == 'os' assert n.type == 'module' - n = nms[1].goto_assignments()[0] + n = nms[1].goto()[0] # This is very special, normally the name doesn't chance, but since # os.path is a sys.modules hack, it does. assert n.name in ('macpath', 'ntpath', 'posixpath', 'os2emxpath') @@ -411,7 +411,7 @@ def test_import_alias(names): assert nms[0].name == 'json' assert nms[0].type == 'module' assert nms[0]._name.tree_name.parent.type == 'dotted_as_name' - n = nms[0].goto_assignments()[0] + n = nms[0].goto()[0] assert n.name == 'json' assert n.type == 'module' assert n._name._value.tree_node.type == 'file_input' @@ -419,7 +419,7 @@ def test_import_alias(names): assert nms[1].name == 'foo' assert nms[1].type == 'module' assert nms[1]._name.tree_name.parent.type == 'dotted_as_name' - ass = nms[1].goto_assignments() + ass = nms[1].goto() assert len(ass) == 1 assert ass[0].name == 'json' assert ass[0].type == 'module' diff --git a/test/test_api/test_defined_names.py b/test/test_api/test_defined_names.py index 259e3602..6633a04f 100644 --- a/test/test_api/test_defined_names.py +++ b/test/test_api/test_defined_names.py @@ -166,4 +166,4 @@ def test_no_error(names): assert a.name == 'a' assert b.name == 'b' assert a20.name == 'a' - assert a20.goto_assignments() == [a20] + assert a20.goto() == [a20] diff --git a/test/test_api/test_keyword.py b/test/test_api/test_keyword.py index 219e3ff8..76e5f4d0 100644 --- a/test/test_api/test_keyword.py +++ b/test/test_api/test_keyword.py @@ -35,8 +35,8 @@ def test_keyword_attributes(Script): assert def_.complete == '' assert def_.is_keyword is True assert def_.is_stub() is False - assert def_.goto_assignments(only_stubs=True) == [] - assert def_.goto_assignments() == [] + assert def_.goto(only_stubs=True) == [] + assert def_.goto() == [] assert def_.infer() == [] assert def_.parent() is None assert def_.docstring() diff --git a/test/test_inference/test_gradual/test_stubs.py b/test/test_inference/test_gradual/test_stubs.py index 4642c466..0c5df5e6 100644 --- a/test/test_inference/test_gradual/test_stubs.py +++ b/test/test_inference/test_gradual/test_stubs.py @@ -74,7 +74,7 @@ def test_infer_and_goto(Script, code, full_name, has_stub, has_python, way, follow_imports=True, ) if type_ == 'goto': - defs = [d for goto_def in goto_defs for d in goto_def.goto_assignments(**kwargs)] + defs = [d for goto_def in goto_defs for d in goto_def.goto(**kwargs)] else: defs = [d for goto_def in goto_defs for d in goto_def.infer(**kwargs)] diff --git a/test/test_inference/test_gradual/test_typeshed.py b/test/test_inference/test_gradual/test_typeshed.py index 8b7285de..a6f0060f 100644 --- a/test/test_inference/test_gradual/test_typeshed.py +++ b/test/test_inference/test_gradual/test_typeshed.py @@ -63,7 +63,7 @@ def test_keywords_variable(Script): for seq in Script(code).goto_definitions(): assert seq.name == 'Sequence' # This points towards the typeshed implementation - stub_seq, = seq.goto_assignments(only_stubs=True) + stub_seq, = seq.goto(only_stubs=True) assert typeshed.TYPESHED_PATH in stub_seq.module_path @@ -156,12 +156,12 @@ def test_math_is_stub(Script, code, full_name): wanted = os.path.join('typeshed', 'stdlib', '2and3', 'math.pyi') assert cos.module_path.endswith(wanted) assert cos.is_stub() is True - assert cos.goto_assignments(only_stubs=True) == [cos] + assert cos.goto(only_stubs=True) == [cos] assert cos.full_name == full_name cos, = s.goto_assignments() assert cos.module_path.endswith(wanted) - assert cos.goto_assignments(only_stubs=True) == [cos] + assert cos.goto(only_stubs=True) == [cos] assert cos.is_stub() is True assert cos.full_name == full_name @@ -171,7 +171,7 @@ def test_goto_stubs(Script): os_module, = s.goto_definitions() assert os_module.full_name == 'os' assert os_module.is_stub() is False - stub, = os_module.goto_assignments(only_stubs=True) + stub, = os_module.goto(only_stubs=True) assert stub.is_stub() is True os_module, = s.goto_assignments() @@ -202,7 +202,7 @@ def test_goto_stubs_on_itself(Script, code, type_): def_, = s.goto_definitions() else: def_, = s.goto_assignments(follow_imports=True) - stub, = def_.goto_assignments(only_stubs=True) + stub, = def_.goto(only_stubs=True) script_on_source = Script( path=def_.module_path, @@ -213,7 +213,7 @@ def test_goto_stubs_on_itself(Script, code, type_): definition, = script_on_source.goto_definitions() else: definition, = script_on_source.goto_assignments() - same_stub, = definition.goto_assignments(only_stubs=True) + same_stub, = definition.goto(only_stubs=True) _assert_is_same(same_stub, stub) _assert_is_same(definition, def_) assert same_stub.module_path != def_.module_path @@ -230,7 +230,7 @@ def test_goto_stubs_on_itself(Script, code, type_): same_definition2, = same_stub.infer() else: same_definition, = script_on_stub.goto_assignments() - same_definition2, = same_stub.goto_assignments() + same_definition2, = same_stub.goto() _assert_is_same(same_definition, definition) _assert_is_same(same_definition, same_definition2)