void () { final CodeStyleSettings settings = getCodeStyleSettings(); final CommonCodeStyleSettings commonSettings = settings.getCommonSettings(PythonLanguage.getInstance()); final int oldRightMargin = settings.getRightMargin(PythonLanguage.getInstance()); final boolean oldWrapLongLines = commonSettings.WRAP_LONG_LINES; boolean initialValue = PyCodeInsightSettings.getInstance().PARENTHESISE_ON_ENTER; settings.setRightMargin(PythonLanguage.getInstance(), 80); commonSettings.WRAP_LONG_LINES = true; try { PyCodeInsightSettings.getInstance().PARENTHESISE_ON_ENTER = true; doTest(); } finally { commonSettings.WRAP_LONG_LINES = oldWrapLongLines; settings.setRightMargin(PythonLanguage.getInstance(), oldRightMargin); PyCodeInsightSettings.getInstance().PARENTHESISE_ON_ENTER = initialValue; } }