fix(tests): serialize ternary expressions

This commit is contained in:
2026-06-02 13:05:06 +02:00
parent a4139d4652
commit 1c5c418f1c

View File

@@ -22,6 +22,7 @@ from midas.ast.python import (
ReturnStmt,
SetExpr,
Stmt,
TernaryExpr,
TypeAssign,
UnaryExpr,
VariableExpr,
@@ -245,3 +246,11 @@ class PythonAstJsonSerializer(
"type": expr.type.accept(self),
"expr": expr.expr.accept(self),
}
def visit_ternary_expr(self, expr: TernaryExpr) -> dict:
return {
"_type": "TernaryExpr",
"test": expr.test.accept(self),
"if_true": expr.if_true.accept(self),
"if_false": expr.if_false.accept(self),
}