void () { Map<String, PsiElement> marks = loadTest(); Assert.assertEquals(6, marks.size()); PsiElement elt = marks.get("<stmt>").getParent().getParent(); // keyword -> part -> stmt Assert.assertTrue(elt instanceof PyTryExceptStatement); PyTryExceptStatement stmt = (PyTryExceptStatement)elt; PyTryPart try_part = stmt.getTryPart(); PyStatementList stmt_list = try_part.getStatementList(); Assert.assertNotNull(stmt_list); Assert.assertEquals(marks.get("<body>").getParent().getParent(), stmt_list); // keyword -> stmt -> stmt_list PyExceptPart exc_part = stmt.getExceptParts()[0]; Assert.assertEquals("ArithmeticError", exc_part.getExceptClass().getText()); Assert.assertEquals(marks.get("<ex1>").getParent(), exc_part); exc_part = (PyExceptPart)marks.get("<ex2>").getParent(); // keyword -> part Assert.assertEquals(stmt.getExceptParts()[1], exc_part); Assert.assertNull(exc_part.getExceptClass()); elt = marks.get("<else>").getParent(); // keyword -> part Assert.assertTrue(elt instanceof PyElsePart); Assert.assertEquals(stmt.getElsePart(), elt); elt = marks.get("<finally>").getParent(); // keyword -> part Assert.assertTrue(elt instanceof PyFinallyPart); Assert.assertEquals(stmt.getFinallyPart(), elt); }