void () { Map<String, PsiElement> marks = loadTest(); Assert.assertEquals(6, marks.size()); PsiElement elt = marks.get("<the_if>").getParent().getParent(); // if_keyword -> if_part -> if_stmt Assert.assertTrue(elt instanceof PyIfStatement); PyIfStatement if_stmt = (PyIfStatement)elt; PyIfPart if_part = if_stmt.getIfPart(); Assert.assertFalse(if_part.isElif()); PyExpression if_cond = if_part.getCondition(); Assert.assertEquals(marks.get("<the_cond>").getParent(), if_cond); PyStatementList stmt_list = if_part.getStatementList(); Assert.assertNotNull(stmt_list); Assert.assertEquals(marks.get("<then_stmt>").getParent().getParent(), stmt_list); // keyword -> stmt -> stmt_list PyElsePart else_part = if_stmt.getElsePart(); Assert.assertNotNull(else_part); stmt_list = else_part.getStatementList(); Assert.assertNotNull(stmt_list); Assert.assertEquals(marks.get("<else_stmt>").getParent().getParent(), stmt_list); // keyword -> stmt -> stmt_list PyIfPart elif_part = if_stmt.getElifParts()[0]; Assert.assertTrue(elif_part.isElif()); if_cond = elif_part.getCondition(); Assert.assertEquals(marks.get("<elif_cond>").getParent(), if_cond); stmt_list = elif_part.getStatementList(); Assert.assertNotNull(stmt_list); Assert.assertEquals(marks.get("<elif_stmt>").getParent().getParent(), stmt_list); // keyword -> stmt -> stmt_list }