mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-12008 Add a bunch of tests covering various cases of malformed if statements
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
if foo and \
|
||||
bar == 42:
|
||||
pass
|
||||
elif foo and \
|
||||
bar:
|
||||
pass
|
||||
elif foo and \
|
||||
bar == 24:
|
||||
pass
|
||||
@@ -0,0 +1,9 @@
|
||||
if (foo and
|
||||
bar == 42):
|
||||
pass
|
||||
elif (foo and
|
||||
bar):
|
||||
pass
|
||||
elif (foo and
|
||||
bar == 24):
|
||||
pass
|
||||
@@ -0,0 +1,9 @@
|
||||
if (foo and
|
||||
bar == 42):
|
||||
pass
|
||||
elif (foo and
|
||||
bar):
|
||||
pass
|
||||
elif (foo and
|
||||
bar == 24):
|
||||
pass
|
||||
@@ -0,0 +1,9 @@
|
||||
if foo and \
|
||||
bar == 42:
|
||||
pass
|
||||
elif foo and \
|
||||
bar:
|
||||
pass
|
||||
elif foo and \
|
||||
bar == 24:
|
||||
pass
|
||||
@@ -0,0 +1,9 @@
|
||||
a = b = c = 0
|
||||
if (a and b and c or
|
||||
a and b or
|
||||
a or
|
||||
a and b or
|
||||
a and b and c or
|
||||
a and b or
|
||||
a):
|
||||
pass
|
||||
@@ -0,0 +1,9 @@
|
||||
a = b = c = 0
|
||||
if (a and b and c or
|
||||
a and b or
|
||||
a or
|
||||
a and b or
|
||||
a and b and c or
|
||||
a and b or
|
||||
a):
|
||||
pass
|
||||
@@ -0,0 +1,3 @@
|
||||
if (foo is None and
|
||||
bar == 42):
|
||||
pass
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
if (foo == 42 and
|
||||
bar):
|
||||
pass
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
if (foo == 42 and
|
||||
bar):
|
||||
pass
|
||||
@@ -0,0 +1,3 @@
|
||||
if (foo is None and
|
||||
bar == 42):
|
||||
pass
|
||||
@@ -0,0 +1,3 @@
|
||||
if (foo is None
|
||||
and bar == 42):
|
||||
pass
|
||||
@@ -0,0 +1,3 @@
|
||||
if (foo is None
|
||||
and bar == 42):
|
||||
pass
|
||||
@@ -0,0 +1,3 @@
|
||||
if not (foo == 42 or
|
||||
bar == 42):
|
||||
pass
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
if not (foo == 42 or
|
||||
bar == 42):
|
||||
pass
|
||||
@@ -0,0 +1,4 @@
|
||||
if (foo == 42 or
|
||||
bar == 42 and
|
||||
baz == 42):
|
||||
pass
|
||||
@@ -0,0 +1,4 @@
|
||||
if (foo == 42 or
|
||||
bar == 42 and
|
||||
baz == 42):
|
||||
pass
|
||||
@@ -0,0 +1,3 @@
|
||||
if foo is None and \
|
||||
bar == 42:
|
||||
pass
|
||||
@@ -0,0 +1,3 @@
|
||||
if foo is None and \
|
||||
bar == 42:
|
||||
pass
|
||||
@@ -0,0 +1,3 @@
|
||||
if foo is None \
|
||||
and bar == 42:
|
||||
pass
|
||||
@@ -0,0 +1,3 @@
|
||||
if foo is None \
|
||||
and bar == 42:
|
||||
pass
|
||||
@@ -0,0 +1,3 @@
|
||||
if 1 < 4 and \
|
||||
5 < 7: # WRONG again, too many spaces
|
||||
pass
|
||||
@@ -0,0 +1,3 @@
|
||||
if 1 < 4 and \
|
||||
5 < 7: # WRONG again, too many spaces
|
||||
pass
|
||||
@@ -0,0 +1,4 @@
|
||||
if foo == 42 or \
|
||||
bar == 42 and \
|
||||
baz == 42:
|
||||
pass
|
||||
@@ -0,0 +1,4 @@
|
||||
if foo == 42 or \
|
||||
bar == 42 and \
|
||||
baz == 42:
|
||||
pass
|
||||
@@ -857,6 +857,56 @@ public class PyFormatterTest extends PyTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testMultilineIfConditionKeywordAtEnd() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-21328
|
||||
public void testMultilineIfConditionLessComparisonsKeywordAtEnd() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testMultilineIfConditionKeywordAtStart() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testMultilineIfConditionInParenthesesKeywordAtEnd() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testMultilineIfConditionInParenthesesNegatedKeywordAtEnd() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testMultilineIfConditionInParenthesesKeywordAtEndSecondOperandIsReference() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testMultilineIfConditionInParenthesesKeywordAtStart() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testMultilineIfConditionNestedExpressions() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testMultilineIfConditionInParenthesesNestedExpressions() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testMultilineElifCondition() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testMultilineElifConditionInParentheses() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-22035
|
||||
public void testMultilineIfConditionComplex() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testVariableAnnotations() {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON36, this::doTest);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user