mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
Make it possible to format a param to a string, fixes #1074
This commit is contained in:
@@ -47,3 +47,16 @@ def test_param_default(Script, code, expected_params):
|
|||||||
else:
|
else:
|
||||||
annotation, = annotations
|
annotation, = annotations
|
||||||
assert annotation.description == expected
|
assert annotation.description == expected
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
'code, index, param_code, kind', [
|
||||||
|
('def f(x=1): ...\nf', 0, 'x=1', ...),
|
||||||
|
('def f(*args:int): ...\nf', 0, '*args: int', ...),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
def test_param_kind_and_name(code, index, param_code, kind, Script, skip_python2):
|
||||||
|
func, = Script(code).goto_assignments()
|
||||||
|
sig, = func.get_signatures()
|
||||||
|
param = sig.params[index]
|
||||||
|
assert param.to_string() == param_code
|
||||||
|
|||||||
Reference in New Issue
Block a user