diff --git a/jedi/api/classes.py b/jedi/api/classes.py index 77fb7ee9..c8740373 100644 --- a/jedi/api/classes.py +++ b/jedi/api/classes.py @@ -13,6 +13,7 @@ from jedi.cache import memoize_method from jedi.evaluate import imports from jedi.evaluate import compiled from jedi.evaluate.imports import ImportName +from jedi.evaluate.filters import ParamName from jedi.evaluate.context import FunctionExecutionContext from jedi.evaluate.gradual.typeshed import StubOnlyModuleContext from jedi.api.keywords import KeywordName @@ -323,7 +324,9 @@ class BaseDefinition(object): def infer(self): tree_name = self._name.tree_name parent_context = self._name.parent_context - if tree_name is None or parent_context is None: + # Param names are special because they are not handled by + # the evaluator method. + if tree_name is None or parent_context is None or isinstance(self._name, ParamName): context_set = self._name.infer() else: context_set = self._evaluator.goto_definitions(parent_context, tree_name) diff --git a/test/test_api/test_call_signatures.py b/test/test_api/test_call_signatures.py index 47d17da7..28cb619d 100644 --- a/test/test_api/test_call_signatures.py +++ b/test/test_api/test_call_signatures.py @@ -7,7 +7,6 @@ import pytest from ..helpers import TestCase from jedi import cache from jedi.parser_utils import get_call_signature -from jedi._compatibility import is_py3 def assert_signature(Script, source, expected_name, expected_index=0, line=None, column=None): @@ -308,18 +307,16 @@ def test_signature_is_definition(Script): # Now compare all the attributes that a CallSignature must also have. for attr_name in dir(definition): - dont_scan = ['defined_names', 'parent', 'goto_assignments', 'params'] + dont_scan = ['defined_names', 'parent', 'goto_assignments', 'infer', 'params'] if attr_name.startswith('_') or attr_name in dont_scan: continue - # Might trigger some deprecation warnings. - with warnings.catch_warnings(record=True): - attribute = getattr(definition, attr_name) - signature_attribute = getattr(signature, attr_name) - if inspect.ismethod(attribute): - assert attribute() == signature_attribute() - else: - assert attribute == signature_attribute + attribute = getattr(definition, attr_name) + signature_attribute = getattr(signature, attr_name) + if inspect.ismethod(attribute): + assert attribute() == signature_attribute() + else: + assert attribute == signature_attribute def test_no_signature(Script): diff --git a/test/test_api/test_environment.py b/test/test_api/test_environment.py index 40f48d36..2d774a8e 100644 --- a/test/test_api/test_environment.py +++ b/test/test_api/test_environment.py @@ -79,7 +79,7 @@ def test_killed_subprocess(evaluator, Script, environment): if isinstance(environment, InterpreterEnvironment): pytest.skip("We cannot kill our own process") # Just kill the subprocess. - evaluator.compiled_subprocess._compiled_subprocess._process.kill() + evaluator.compiled_subprocess._compiled_subprocess._get_process().kill() # Since the process was terminated (and nobody knows about it) the first # Jedi call fails. with pytest.raises(jedi.InternalError):