mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
find_signatures -> get_signatures, see #1476
This commit is contained in:
@@ -90,9 +90,9 @@ def test_tree_signature(Script, environment, code, expected):
|
||||
pytest.skip()
|
||||
|
||||
if expected is None:
|
||||
assert not Script(code).find_signatures()
|
||||
assert not Script(code).get_signatures()
|
||||
else:
|
||||
sig, = Script(code).find_signatures()
|
||||
sig, = Script(code).get_signatures()
|
||||
assert expected == sig.to_string()
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ def test_nested_signatures(Script, environment, combination, expected, skip_pre_
|
||||
def __init__(self, i, t: T): ...
|
||||
''')
|
||||
code += 'z = ' + combination + '\nz('
|
||||
sig, = Script(code).find_signatures()
|
||||
sig, = Script(code).get_signatures()
|
||||
computed = sig.to_string()
|
||||
if not re.match(r'\w+\(', expected):
|
||||
expected = '<lambda>(' + expected + ')'
|
||||
@@ -207,7 +207,7 @@ def test_nested_signatures(Script, environment, combination, expected, skip_pre_
|
||||
|
||||
def test_pow_signature(Script):
|
||||
# See github #1357
|
||||
sigs = Script('pow(').find_signatures()
|
||||
sigs = Script('pow(').get_signatures()
|
||||
strings = {sig.to_string() for sig in sigs}
|
||||
assert strings == {'pow(x: float, y: float, z: float, /) -> float',
|
||||
'pow(x: float, y: float, /) -> float',
|
||||
@@ -246,7 +246,7 @@ def test_pow_signature(Script):
|
||||
]
|
||||
)
|
||||
def test_wraps_signature(Script, code, signature, skip_pre_python35):
|
||||
sigs = Script(code).find_signatures()
|
||||
sigs = Script(code).get_signatures()
|
||||
assert {sig.to_string() for sig in sigs} == {signature}
|
||||
|
||||
|
||||
@@ -279,7 +279,7 @@ def test_dataclass_signature(Script, skip_pre_python37, start, start_params):
|
||||
|
||||
code = 'from dataclasses import dataclass\n' + start + code
|
||||
|
||||
sig, = Script(code).find_signatures()
|
||||
sig, = Script(code).get_signatures()
|
||||
assert [p.name for p in sig.params] == start_params + ['name', 'price', 'quantity']
|
||||
quantity, = sig.params[-1].infer()
|
||||
assert quantity.name == 'int'
|
||||
@@ -305,7 +305,7 @@ def test_param_resolving_to_static(Script, stmt, expected, skip_pre_python35):
|
||||
def simple(a, b, *, c): ...
|
||||
full_redirect(simple)('''.format(stmt=stmt))
|
||||
|
||||
sig, = Script(code).find_signatures()
|
||||
sig, = Script(code).get_signatures()
|
||||
assert sig.to_string() == expected
|
||||
|
||||
|
||||
@@ -317,6 +317,6 @@ def test_param_resolving_to_static(Script, stmt, expected, skip_pre_python35):
|
||||
)
|
||||
def test_overload(Script, code):
|
||||
dir_ = get_example_dir('typing_overload')
|
||||
x1, x2 = Script(code, path=os.path.join(dir_, 'foo.py')).find_signatures()
|
||||
x1, x2 = Script(code, path=os.path.join(dir_, 'foo.py')).get_signatures()
|
||||
assert x1.to_string() == 'with_overload(x: int, y: int) -> float'
|
||||
assert x2.to_string() == 'with_overload(x: str, y: list) -> float'
|
||||
|
||||
Reference in New Issue
Block a user