mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 06:24:27 +08:00
Return annotations for compiled objects now help to infer
However only if it's a type, if it's a string, it doesn't work, yet Fixes #1347
This commit is contained in:
@@ -262,7 +262,7 @@ def test_completion_params():
|
||||
def test_completion_param_annotations():
|
||||
# Need to define this function not directly in Python. Otherwise Jedi is to
|
||||
# clever and uses the Python code instead of the signature object.
|
||||
code = 'def foo(a: 1, b: str, c: int = 1.0): pass'
|
||||
code = 'def foo(a: 1, b: str, c: int = 1.0) -> bytes: pass'
|
||||
exec_(code, locals())
|
||||
script = jedi.Interpreter('foo', [locals()])
|
||||
c, = script.completions()
|
||||
@@ -271,6 +271,9 @@ def test_completion_param_annotations():
|
||||
assert [d.name for d in b.infer()] == ['str']
|
||||
assert {d.name for d in c.infer()} == {'int', 'float'}
|
||||
|
||||
d, = jedi.Interpreter('foo()', [locals()]).goto_definitions()
|
||||
assert d.name == 'bytes'
|
||||
|
||||
|
||||
def test_keyword_argument():
|
||||
def f(some_keyword_argument):
|
||||
|
||||
Reference in New Issue
Block a user