fixed PY-10364 Print statement -> function inspection is not PEP-8 compatible

This commit is contained in:
Ekaterina Tuzova
2013-07-26 13:22:34 +04:00
parent 31faaaa577
commit d4ea1ffaa5
4 changed files with 7 additions and 1 deletions
@@ -36,7 +36,7 @@ public class CompatibilityPrintCallQuickFix implements LocalQuickFix {
}
private static void replacePrint(PsiElement expression, PyElementGenerator elementGenerator) {
StringBuilder stringBuilder = new StringBuilder("print (");
StringBuilder stringBuilder = new StringBuilder("print(");
PyExpression[] target = PsiTreeUtil.getChildrenOfType(expression, PyExpression.class);
if (target != null) {
@@ -0,0 +1 @@
<warning descr="Python version >= 3.0 do not support this syntax. The print statement has been replaced with a print() function">print <caret>"foo"</warning>
@@ -0,0 +1 @@
print("foo")
@@ -81,6 +81,10 @@ public class PyQuickFixTest extends PyTestCase {
doInspectionTest("AddSelf.py", PyMethodParametersInspection.class, PyBundle.message("QFIX.add.parameter.self", "self"), true, true);
}
public void testReplacePrint() {
doInspectionTest("ReplacePrint.py", PyCompatibilityInspection.class, PyBundle.message("QFIX.statement.effect"), true, true);
}
public void testAddSelfFunction() { //PY-4556
doInspectionTest("AddSelfFunction.py",
PyUnresolvedReferencesInspection.class, PyBundle.message("QFIX.unresolved.reference", "get_a", "self"), true, true);