Remove core.python.arguments.PythonFunctionArgumentDefault; use strings instead

This commit is contained in:
2026-04-12 19:13:39 +02:00
parent 73730520c1
commit e4fe88b60b
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from src.jcloud_docsgen.core.python.arguments import PythonFunctionArgument, PythonArgumentKind, PythonFunctionArgumentDefault
from src.jcloud_docsgen.core.python.arguments import PythonFunctionArgument, PythonArgumentKind
from src.jcloud_docsgen.exceptions import InvalidPythonIdentifierError, InvalidPythonAnnotationError
import ast
import pytest
@@ -23,7 +23,7 @@ import pytest
(42, PythonArgumentKind.NORMAL, None, None, TypeError, 'expected \'str\', got \'int\''),
(4.2, PythonArgumentKind.NORMAL, None, None, TypeError, 'expected \'str\', got \'float\''),
(4.2, PythonArgumentKind.NORMAL, None, None, TypeError, 'expected \'str\', got \'float\''),
('a', PythonArgumentKind.NORMAL, 1, None, TypeError, 'expected either \'PythonFunctionArgumentDefault\' or \'NoneType\', got \'int\''),
('a', PythonArgumentKind.NORMAL, 1, None, TypeError, 'expected either \'str\' or \'NoneType\', got \'int\''),
('a', PythonArgumentKind.NORMAL, None, 1, TypeError, 'expected either \'str\' or \'NoneType\', got \'int\''),
('a', 0, None, None, TypeError, 'expected \'PythonArgumentKind\', got \'int\''),
('a', PythonArgumentKind.NORMAL, None, '', InvalidPythonAnnotationError, 'invalid annotation'),
@@ -89,9 +89,9 @@ def test_PythonFunctionArgument_exceptions(name, kind, default, annotation, expe
])
@pytest.mark.parametrize('default', [
None,
PythonFunctionArgumentDefault(ast.Constant(value = 'x')),
PythonFunctionArgumentDefault(ast.Constant(value = 1)),
PythonFunctionArgumentDefault(ast.Constant(value = None)),
'x',
'1',
None,
])
@pytest.mark.parametrize('annotation', [
None,