Simplify main() of test_ast

* Use ast.parse() to get the AST for a statement
* Use str%args syntax for format a line

Issue #26204.
1 file changed