PythonTreeMaker { public AssertStatement assertStatement(StatementWithSeparator statementWithSeparator) { AstNode stmt = statementWithSeparator.statement(); Separators separators = statementWithSeparator.separator(); List<Expression> expressions = expressionsFromTest(stmt); Expression condition = expressions.get(0); Expression message = null; if (expressions.size() > 1) { message = expressions.get(1); } return new AssertStatementImpl(toPyToken(stmt.getTokens()).get(0), condition, message, separators); }  FileInput fileInput(AstNode astNode); void setParents(Tree root); AnnotatedAssignment annotatedAssignment(StatementWithSeparator statementWithSeparator); PrintStatement printStatement(StatementWithSeparator statementWithSeparator); ExecStatement execStatement(StatementWithSeparator statementWithSeparator); AssertStatement assertStatement(StatementWithSeparator statementWithSeparator); PassStatement passStatement(StatementWithSeparator statementWithSeparator); DelStatement delStatement(StatementWithSeparator statementWithSeparator); ReturnStatement returnStatement(StatementWithSeparator statementWithSeparator); YieldStatement yieldStatement(StatementWithSeparator statementWithSeparator); YieldExpression yieldExpression(AstNode astNode); RaiseStatement raiseStatement(StatementWithSeparator statementWithSeparator); BreakStatement breakStatement(StatementWithSeparator statementWithSeparator); ContinueStatement continueStatement(StatementWithSeparator statementWithSeparator); ImportStatement importStatement(StatementWithSeparator statementWithSeparator); GlobalStatement globalStatement(StatementWithSeparator statementWithSeparator); NonlocalStatement nonlocalStatement(StatementWithSeparator statementWithSeparator); IfStatement ifStatement(AstNode astNode); FunctionDef funcDefStatement(AstNode astNode); ClassDef classDefStatement(AstNode astNode); ForStatement forStatement(AstNode astNode); WhileStatementImpl whileStatement(AstNode astNode); ExpressionStatement expressionStatement(StatementWithSeparator statementWithSeparator); AssignmentStatement assignment(StatementWithSeparator statementWithSeparator); CompoundAssignmentStatement compoundAssignment(StatementWithSeparator statementWithSeparator); TryStatement tryStatement(AstNode astNode); WithStatement withStatement(AstNode astNode); Expression expression(AstNode astNode); Argument argument(AstNode astNode); LambdaExpression lambdaExpression(AstNode astNode);  }
@Test public void assertStatement() { setRootRule(PythonGrammar.ASSERT_STMT); AstNode astNode = p.parse("assert x"); StatementWithSeparator statementWithSeparator = new StatementWithSeparator(astNode, null); AssertStatement assertStatement = treeMaker.assertStatement(statementWithSeparator); assertThat(assertStatement).isNotNull(); assertThat(assertStatement.assertKeyword().value()).isEqualTo("assert"); assertThat(assertStatement.condition()).isNotNull(); assertThat(assertStatement.message()).isNull(); assertThat(assertStatement.children()).hasSize(2); astNode = p.parse("assert x, y"); statementWithSeparator = new StatementWithSeparator(astNode, null); assertStatement = treeMaker.assertStatement(statementWithSeparator); assertThat(assertStatement).isNotNull(); assertThat(assertStatement.assertKeyword().value()).isEqualTo("assert"); assertThat(assertStatement.condition()).isNotNull(); assertThat(assertStatement.message()).isNotNull(); assertThat(assertStatement.children()).hasSize(3); }