From 642e8f2aa6c0a9b78ff940efed1d6a966577d4b2 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Fri, 2 Aug 2019 12:15:05 +0200 Subject: [PATCH] Make it possible to format a param to a string, fixes #1074 --- test/test_api/test_signatures.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/test_api/test_signatures.py b/test/test_api/test_signatures.py index 628c5128..d051e605 100644 --- a/test/test_api/test_signatures.py +++ b/test/test_api/test_signatures.py @@ -47,3 +47,16 @@ def test_param_default(Script, code, expected_params): else: annotation, = annotations 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