diff --git a/tests/unit/core/python/arguments/test_PythonFunctionArgument.py b/tests/unit/core/python/arguments/test_PythonFunctionArgument.py index b242fd3..4439576 100644 --- a/tests/unit/core/python/arguments/test_PythonFunctionArgument.py +++ b/tests/unit/core/python/arguments/test_PythonFunctionArgument.py @@ -133,4 +133,25 @@ def test_PythonFunctionArgument(name, kind, default, annotation): '_', ]) def test_PythonFunctionArgument_asterik(name, kind, annotation): - PythonFunctionArgument(name, kind, None, annotation) \ No newline at end of file + PythonFunctionArgument(name, kind, None, annotation) + +@pytest.mark.parametrize('argument,expected', [ + (PythonFunctionArgument('a', PythonArgumentKind.NORMAL, None, None), 'a'), + (PythonFunctionArgument('a', PythonArgumentKind.NORMAL, '1', None), 'a = 1'), + (PythonFunctionArgument('a', PythonArgumentKind.NORMAL, None, 'int'), 'a: int'), + (PythonFunctionArgument('a', PythonArgumentKind.NORMAL, '1', 'int'), 'a: int = 1'), + (PythonFunctionArgument('a', PythonArgumentKind.POSITIONAL_ONLY, None, None), 'a'), + (PythonFunctionArgument('a', PythonArgumentKind.POSITIONAL_ONLY, '1', None), 'a = 1'), + (PythonFunctionArgument('a', PythonArgumentKind.POSITIONAL_ONLY, None, 'int'), 'a: int'), + (PythonFunctionArgument('a', PythonArgumentKind.POSITIONAL_ONLY, '1', 'int'), 'a: int = 1'), + (PythonFunctionArgument('a', PythonArgumentKind.KEYWORD_ONLY, None, None), 'a'), + (PythonFunctionArgument('a', PythonArgumentKind.KEYWORD_ONLY, '1', None), 'a = 1'), + (PythonFunctionArgument('a', PythonArgumentKind.KEYWORD_ONLY, None, 'int'), 'a: int'), + (PythonFunctionArgument('a', PythonArgumentKind.KEYWORD_ONLY, '1', 'int'), 'a: int = 1'), + (PythonFunctionArgument('a', PythonArgumentKind.VARARG, None, None), '*a'), + (PythonFunctionArgument('a', PythonArgumentKind.VARARG, None, 'int'), '*a: int'), + (PythonFunctionArgument('a', PythonArgumentKind.KWARGS, None, None), '**a'), + (PythonFunctionArgument('a', PythonArgumentKind.KWARGS, None, 'int'), '**a: int'), +]) +def test_PythonFunctionArgument_signature_repr(argument, expected): + assert argument.signature_repr() == expected \ No newline at end of file