void (boolean doExpand) { final String initial = doExpand ? "CollapseAllRegions" : "ExpandAllRegions"; final String action = doExpand ? "ExpandDocComments" : "CollapseDocComments"; final String logAction = doExpand ? "collapsed: " : "expanded: "; myFixture.performEditorAction(initial); myFixture.performEditorAction(action); final Editor editor = myFixture.getEditor(); for (FoldRegion region : editor.getFoldingModel().getAllFoldRegions()) { PsiElement element = EditorFoldingInfo.get(editor).getPsiElement(region); if (element instanceof PyStringLiteralExpression && ((PyStringLiteralExpression)element).isDocString()) { assertEquals(logAction + element.getText(), doExpand, region.isExpanded()); } else { assertEquals("not " + logAction + element.getText(), doExpand, !region.isExpanded()); } } }