generated from jCloud/repository-template
style: ensure trailing commas in multi-line statements
This commit is contained in:
30 files changed
+1778
-1774
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -14,12 +14,12 @@
|
||||
|
||||
from src.jcloud_docsgen.core.python.arguments import (
|
||||
PythonFunctionArgument,
|
||||
PythonArgumentKind
|
||||
PythonArgumentKind,
|
||||
)
|
||||
from src.jcloud_docsgen.exceptions import (
|
||||
InvalidPythonIdentifierError,
|
||||
InvalidPythonAnnotationError,
|
||||
PythonArgumentStructureError
|
||||
PythonArgumentStructureError,
|
||||
)
|
||||
import pytest
|
||||
|
||||
@@ -32,7 +32,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
TypeError,
|
||||
'expected \'str\', got \'NoneType\''
|
||||
'expected \'str\', got \'NoneType\'',
|
||||
),
|
||||
(
|
||||
1,
|
||||
@@ -40,7 +40,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
TypeError,
|
||||
'expected \'str\', got \'int\''
|
||||
'expected \'str\', got \'int\'',
|
||||
),
|
||||
(
|
||||
42,
|
||||
@@ -48,7 +48,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
TypeError,
|
||||
'expected \'str\', got \'int\''
|
||||
'expected \'str\', got \'int\'',
|
||||
),
|
||||
(
|
||||
4.2,
|
||||
@@ -56,7 +56,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
TypeError,
|
||||
'expected \'str\', got \'float\''
|
||||
'expected \'str\', got \'float\'',
|
||||
),
|
||||
(
|
||||
4.2,
|
||||
@@ -64,7 +64,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
TypeError,
|
||||
'expected \'str\', got \'float\''
|
||||
'expected \'str\', got \'float\'',
|
||||
),
|
||||
(
|
||||
'a',
|
||||
@@ -72,7 +72,7 @@ import pytest
|
||||
1,
|
||||
None,
|
||||
TypeError,
|
||||
'expected either \'str\' or \'NoneType\', got \'int\''
|
||||
'expected either \'str\' or \'NoneType\', got \'int\'',
|
||||
),
|
||||
(
|
||||
'a',
|
||||
@@ -80,7 +80,7 @@ import pytest
|
||||
None,
|
||||
1,
|
||||
TypeError,
|
||||
'expected either \'str\' or \'NoneType\', got \'int\''
|
||||
'expected either \'str\' or \'NoneType\', got \'int\'',
|
||||
),
|
||||
(
|
||||
'a',
|
||||
@@ -88,7 +88,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
TypeError,
|
||||
'expected \'PythonArgumentKind\', got \'int\''
|
||||
'expected \'PythonArgumentKind\', got \'int\'',
|
||||
),
|
||||
(
|
||||
'a',
|
||||
@@ -96,7 +96,7 @@ import pytest
|
||||
None,
|
||||
'',
|
||||
InvalidPythonAnnotationError,
|
||||
'invalid annotation'
|
||||
'invalid annotation',
|
||||
),
|
||||
(
|
||||
'',
|
||||
@@ -104,7 +104,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier'
|
||||
'invalid identifier',
|
||||
),
|
||||
(
|
||||
'.',
|
||||
@@ -112,7 +112,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: .'
|
||||
'invalid identifier: .',
|
||||
),
|
||||
(
|
||||
'#',
|
||||
@@ -120,7 +120,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: #'
|
||||
'invalid identifier: #',
|
||||
),
|
||||
(
|
||||
'1a',
|
||||
@@ -128,7 +128,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: 1a'
|
||||
'invalid identifier: 1a',
|
||||
),
|
||||
(
|
||||
'1_',
|
||||
@@ -136,7 +136,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: 1_'
|
||||
'invalid identifier: 1_',
|
||||
),
|
||||
(
|
||||
'1,',
|
||||
@@ -144,7 +144,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: 1,'
|
||||
'invalid identifier: 1,',
|
||||
),
|
||||
(
|
||||
',',
|
||||
@@ -152,7 +152,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: ,'
|
||||
'invalid identifier: ,',
|
||||
),
|
||||
(
|
||||
':',
|
||||
@@ -160,7 +160,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: :'
|
||||
'invalid identifier: :',
|
||||
),
|
||||
(
|
||||
'-',
|
||||
@@ -168,7 +168,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: -'
|
||||
'invalid identifier: -',
|
||||
),
|
||||
(
|
||||
';',
|
||||
@@ -176,7 +176,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: ;'
|
||||
'invalid identifier: ;',
|
||||
),
|
||||
(
|
||||
'|',
|
||||
@@ -184,7 +184,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: |'
|
||||
'invalid identifier: |',
|
||||
),
|
||||
(
|
||||
'<',
|
||||
@@ -192,7 +192,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: <'
|
||||
'invalid identifier: <',
|
||||
),
|
||||
(
|
||||
'>',
|
||||
@@ -200,7 +200,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: >'
|
||||
'invalid identifier: >',
|
||||
),
|
||||
(
|
||||
'a,',
|
||||
@@ -208,7 +208,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: a,'
|
||||
'invalid identifier: a,',
|
||||
),
|
||||
(
|
||||
',a',
|
||||
@@ -216,7 +216,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: ,a'
|
||||
'invalid identifier: ,a',
|
||||
),
|
||||
(
|
||||
'a:',
|
||||
@@ -224,7 +224,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: a:'
|
||||
'invalid identifier: a:',
|
||||
),
|
||||
(
|
||||
':a',
|
||||
@@ -232,7 +232,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: :a'
|
||||
'invalid identifier: :a',
|
||||
),
|
||||
(
|
||||
'a-',
|
||||
@@ -240,7 +240,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: a-'
|
||||
'invalid identifier: a-',
|
||||
),
|
||||
(
|
||||
'-a',
|
||||
@@ -248,7 +248,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: -a'
|
||||
'invalid identifier: -a',
|
||||
),
|
||||
(
|
||||
'a;',
|
||||
@@ -256,7 +256,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: a;'
|
||||
'invalid identifier: a;',
|
||||
),
|
||||
(
|
||||
';a',
|
||||
@@ -264,7 +264,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: ;a'
|
||||
'invalid identifier: ;a',
|
||||
),
|
||||
(
|
||||
'a|',
|
||||
@@ -272,7 +272,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: a|'
|
||||
'invalid identifier: a|',
|
||||
),
|
||||
(
|
||||
'|a',
|
||||
@@ -280,7 +280,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: |a'
|
||||
'invalid identifier: |a',
|
||||
),
|
||||
(
|
||||
'a<',
|
||||
@@ -288,7 +288,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: a<'
|
||||
'invalid identifier: a<',
|
||||
),
|
||||
(
|
||||
'<a',
|
||||
@@ -296,7 +296,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: <a'
|
||||
'invalid identifier: <a',
|
||||
),
|
||||
(
|
||||
'a>',
|
||||
@@ -304,7 +304,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: a>'
|
||||
'invalid identifier: a>',
|
||||
),
|
||||
(
|
||||
'>a',
|
||||
@@ -312,7 +312,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: >a'
|
||||
'invalid identifier: >a',
|
||||
),
|
||||
(
|
||||
'class',
|
||||
@@ -320,7 +320,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: class'
|
||||
'invalid identifier: class',
|
||||
),
|
||||
(
|
||||
'def',
|
||||
@@ -328,7 +328,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: def'
|
||||
'invalid identifier: def',
|
||||
),
|
||||
(
|
||||
'lambda',
|
||||
@@ -336,7 +336,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: lambda'
|
||||
'invalid identifier: lambda',
|
||||
),
|
||||
(
|
||||
'None',
|
||||
@@ -344,7 +344,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: None'
|
||||
'invalid identifier: None',
|
||||
),
|
||||
(
|
||||
'True',
|
||||
@@ -352,7 +352,7 @@ import pytest
|
||||
None,
|
||||
None,
|
||||
InvalidPythonIdentifierError,
|
||||
'invalid identifier: True'
|
||||
'invalid identifier: True',
|
||||
),
|
||||
(
|
||||
'a',
|
||||
@@ -360,7 +360,7 @@ import pytest
|
||||
'1',
|
||||
None,
|
||||
PythonArgumentStructureError,
|
||||
'* or ** arguments cannot have default values: *a = 1'
|
||||
'* or ** arguments cannot have default values: *a = 1',
|
||||
),
|
||||
(
|
||||
'a',
|
||||
@@ -368,9 +368,9 @@ import pytest
|
||||
'1',
|
||||
None,
|
||||
PythonArgumentStructureError,
|
||||
'* or ** arguments cannot have default values: **a = 1'
|
||||
'* or ** arguments cannot have default values: **a = 1',
|
||||
),
|
||||
]
|
||||
],
|
||||
)
|
||||
def test_PythonFunctionArgument_exceptions(
|
||||
name,
|
||||
@@ -378,7 +378,7 @@ def test_PythonFunctionArgument_exceptions(
|
||||
default,
|
||||
annotation,
|
||||
expected_exception,
|
||||
expected_exception_msg
|
||||
expected_exception_msg,
|
||||
):
|
||||
with pytest.raises(expected_exception) as exc_info:
|
||||
PythonFunctionArgument(name, kind, default, annotation)
|
||||
@@ -459,18 +459,18 @@ def test_PythonFunctionArgument_asterik(name, kind, annotation):
|
||||
'a',
|
||||
PythonArgumentKind.NORMAL,
|
||||
None,
|
||||
None
|
||||
None,
|
||||
),
|
||||
'a'
|
||||
'a',
|
||||
),
|
||||
(
|
||||
PythonFunctionArgument(
|
||||
'a',
|
||||
PythonArgumentKind.NORMAL,
|
||||
'1',
|
||||
None
|
||||
None,
|
||||
),
|
||||
'a = 1'
|
||||
'a = 1',
|
||||
),
|
||||
(
|
||||
PythonFunctionArgument(
|
||||
@@ -479,124 +479,124 @@ def test_PythonFunctionArgument_asterik(name, kind, annotation):
|
||||
None,
|
||||
'int'
|
||||
),
|
||||
'a: int'
|
||||
'a: int',
|
||||
),
|
||||
(
|
||||
PythonFunctionArgument(
|
||||
'a',
|
||||
PythonArgumentKind.NORMAL,
|
||||
'1',
|
||||
'int'
|
||||
'int',
|
||||
),
|
||||
'a: int = 1'
|
||||
'a: int = 1',
|
||||
),
|
||||
(
|
||||
PythonFunctionArgument(
|
||||
'a',
|
||||
PythonArgumentKind.POSITIONAL_ONLY,
|
||||
None,
|
||||
None
|
||||
None,
|
||||
),
|
||||
'a'
|
||||
'a',
|
||||
),
|
||||
(
|
||||
PythonFunctionArgument(
|
||||
'a',
|
||||
PythonArgumentKind.POSITIONAL_ONLY,
|
||||
'1',
|
||||
None
|
||||
None,
|
||||
),
|
||||
'a = 1'
|
||||
'a = 1',
|
||||
),
|
||||
(
|
||||
PythonFunctionArgument(
|
||||
'a',
|
||||
PythonArgumentKind.POSITIONAL_ONLY,
|
||||
None,
|
||||
'int'
|
||||
'int',
|
||||
),
|
||||
'a: int'
|
||||
'a: int',
|
||||
),
|
||||
(
|
||||
PythonFunctionArgument(
|
||||
'a',
|
||||
PythonArgumentKind.POSITIONAL_ONLY,
|
||||
'1',
|
||||
'int'
|
||||
'int',
|
||||
),
|
||||
'a: int = 1'
|
||||
'a: int = 1',
|
||||
),
|
||||
(
|
||||
PythonFunctionArgument(
|
||||
'a',
|
||||
PythonArgumentKind.KEYWORD_ONLY,
|
||||
None,
|
||||
None
|
||||
None,
|
||||
),
|
||||
'a'
|
||||
'a',
|
||||
),
|
||||
(
|
||||
PythonFunctionArgument(
|
||||
'a',
|
||||
PythonArgumentKind.KEYWORD_ONLY,
|
||||
'1',
|
||||
None
|
||||
None,
|
||||
),
|
||||
'a = 1'
|
||||
'a = 1',
|
||||
),
|
||||
(
|
||||
PythonFunctionArgument(
|
||||
'a',
|
||||
PythonArgumentKind.KEYWORD_ONLY,
|
||||
None,
|
||||
'int'
|
||||
'int',
|
||||
),
|
||||
'a: int'
|
||||
'a: int',
|
||||
),
|
||||
(
|
||||
PythonFunctionArgument(
|
||||
'a',
|
||||
PythonArgumentKind.KEYWORD_ONLY,
|
||||
'1',
|
||||
'int'
|
||||
'int',
|
||||
),
|
||||
'a: int = 1'
|
||||
'a: int = 1',
|
||||
),
|
||||
(
|
||||
PythonFunctionArgument(
|
||||
'a',
|
||||
PythonArgumentKind.VARARG,
|
||||
None,
|
||||
None
|
||||
None,
|
||||
),
|
||||
'*a'
|
||||
'*a',
|
||||
),
|
||||
(
|
||||
PythonFunctionArgument(
|
||||
'a',
|
||||
PythonArgumentKind.VARARG,
|
||||
None,
|
||||
'int'
|
||||
'int',
|
||||
),
|
||||
'*a: int'
|
||||
'*a: int',
|
||||
),
|
||||
(
|
||||
PythonFunctionArgument(
|
||||
'a',
|
||||
PythonArgumentKind.KWARGS,
|
||||
None,
|
||||
None
|
||||
None,
|
||||
),
|
||||
'**a'
|
||||
'**a',
|
||||
),
|
||||
(
|
||||
PythonFunctionArgument(
|
||||
'a',
|
||||
PythonArgumentKind.KWARGS,
|
||||
None,
|
||||
'int'
|
||||
'int',
|
||||
),
|
||||
'**a: int'
|
||||
'**a: int',
|
||||
),
|
||||
])
|
||||
def test_PythonFunctionArgument_signature_repr(argument, expected):
|
||||
|
||||
Reference in new issue
Block a user