fixed PY-12679 Remove redundant parenthesis: false negative for duplicated parenthesis in complicated and or statements

This commit is contained in:
Ekaterina Tuzova
2014-05-07 12:32:22 +04:00
parent 1ab69ce2b2
commit f29a1671f4
4 changed files with 12 additions and 0 deletions
@@ -108,6 +108,9 @@ public class PyRedundantParenthesesInspection extends PyInspection {
}
}
}
else if (expression instanceof PyParenthesizedExpression) {
registerProblem(expression, "Remove redundant parentheses", new RedundantParenthesesQuickFix());
}
}
}
@@ -0,0 +1,2 @@
if ((1 and 2 == 'left'<caret>)) or (3):
pass
@@ -0,0 +1,2 @@
if (1 and 2 == 'left') or (3):
pass
@@ -205,6 +205,11 @@ public class PyQuickFixTest extends PyTestCase {
PyBundle.message("QFIX.redundant.parentheses"), true, true);
}
public void testRedundantParenthesesParenthesizedExpression() { // PY-12679
doInspectionTest("RedundantParenthesesParenthesizedExpression.py", PyRedundantParenthesesInspection.class,
PyBundle.message("QFIX.redundant.parentheses"), true, true);
}
public void testChainedComparisons() { // PY-1020
doInspectionTest("ChainedComparisons.py", PyChainedComparisonsInspection.class,
PyBundle.message("QFIX.chained.comparison"), true, true);