void () { myFixture.configureByFile("formatter/" + getTestName(true) + ".py"); WriteCommandAction.runWriteCommandAction(myFixture.getProject(), () -> { final PsiElement elementAtCaret = myFixture.getFile().findElementAt(myFixture.getCaretOffset()); assertNotNull(elementAtCaret); final PyStatement statement = PsiTreeUtil.getParentOfType(elementAtCaret, PyStatement.class, false); assertNotNull(statement); final CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(myFixture.getProject()); codeStyleManager.reformat(statement); }); myFixture.checkResultByFile("formatter/" + getTestName(true) + "_after.py"); }