generated from jCloud/repository-template
Add tests for core.python.arguments.PythonFunctionArgument.signature_repr
This commit is contained in:
@@ -133,4 +133,25 @@ def test_PythonFunctionArgument(name, kind, default, annotation):
|
||||
'_',
|
||||
])
|
||||
def test_PythonFunctionArgument_asterik(name, kind, annotation):
|
||||
PythonFunctionArgument(name, kind, None, annotation)
|
||||
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
|
||||
Reference in New Issue
Block a user