mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
Make sure param annotation completions work
This commit is contained in:
@@ -561,3 +561,17 @@ def test_type_var():
|
||||
x = typing.TypeVar('myvar')
|
||||
def_, = jedi.Interpreter('x', [locals()]).goto_definitions()
|
||||
assert def_.name == 'TypeVar'
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Ignore Python 2, because EOL")
|
||||
@pytest.mark.parametrize('class_is_findable', [False, True])
|
||||
def test_param_annotation_completion(class_is_findable):
|
||||
class Foo:
|
||||
bar = 3
|
||||
|
||||
if not class_is_findable:
|
||||
Foo.__name__ = 'asdf'
|
||||
|
||||
code = 'def CallFoo(x: Foo):\n x.ba'
|
||||
def_, = jedi.Interpreter(code, [locals()]).completions()
|
||||
assert def_.name == 'bar'
|
||||
|
||||
Reference in New Issue
Block a user