mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 13:31:28 +07:00
extracted augment assignment tests
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
exp = 2
|
||||
<weak_warning descr="Assignment can be replaced with augmented assignment">value = value <caret>/ (10**exp) #comment</weak_warning>
|
||||
@@ -0,0 +1,2 @@
|
||||
exp = 2
|
||||
value /= 10 ** exp#comment
|
||||
@@ -0,0 +1,5 @@
|
||||
def retStr():
|
||||
return ''
|
||||
|
||||
s1 = ''
|
||||
<weak_warning descr="Assignment can be replaced with augmented assignment">s1 = s1 <caret>+ retStr()</weak_warning>
|
||||
@@ -0,0 +1,5 @@
|
||||
def retStr():
|
||||
return ''
|
||||
|
||||
s1 = ''
|
||||
s1 += retStr()
|
||||
@@ -0,0 +1 @@
|
||||
<weak_warning descr="Assignment can be replaced with augmented assignment">request = request + " FROM bugs WHERE bug_id = %s" % (str(bug_id))</weak_warning>
|
||||
@@ -0,0 +1 @@
|
||||
request += " FROM bugs WHERE bug_id = %s" % (str(bug_id))
|
||||
@@ -0,0 +1,3 @@
|
||||
v = 0
|
||||
f = 1
|
||||
<weak_warning descr="Assignment can be replaced with augmented assignment">v = <caret>f + v</weak_warning>
|
||||
@@ -0,0 +1,3 @@
|
||||
v = 0
|
||||
f = 1
|
||||
v += f
|
||||
@@ -0,0 +1 @@
|
||||
<weak_warning descr="Assignment can be replaced with augmented assignment">var = <caret>var + 3</weak_warning>
|
||||
@@ -0,0 +1 @@
|
||||
var += 3
|
||||
@@ -0,0 +1,3 @@
|
||||
current_sum = 1
|
||||
numbers = [1, 2, 3]
|
||||
<weak_warning descr="Assignment can be replaced with augmented assignment">current_sum = current_sum + numbers[0]</weak_warning>
|
||||
@@ -0,0 +1,3 @@
|
||||
current_sum = 1
|
||||
numbers = [1, 2, 3]
|
||||
current_sum += numbers[0]
|
||||
@@ -0,0 +1,4 @@
|
||||
class A:
|
||||
x = 3
|
||||
a = A()
|
||||
<weak_warning descr="Assignment can be replaced with augmented assignment">a.x = a.x +<caret> 1</weak_warning>
|
||||
@@ -0,0 +1,4 @@
|
||||
class A:
|
||||
x = 3
|
||||
a = A()
|
||||
a.x += 1
|
||||
@@ -194,41 +194,6 @@ public class PyQuickFixTest extends PyTestCase {
|
||||
PyBundle.message("QFIX.redundant.parentheses"), true, true);
|
||||
}
|
||||
|
||||
public void testAugmentAssignment() { // PY-1415
|
||||
doInspectionTest("AugmentAssignment.py", PyAugmentAssignmentInspection.class,
|
||||
PyBundle.message("QFIX.augment.assignment"), true, true);
|
||||
}
|
||||
|
||||
public void testAugmentAssignmentWithContext() { // PY-2481
|
||||
doInspectionTest("AugmentAssignmentWithContext.py", PyAugmentAssignmentInspection.class,
|
||||
PyBundle.message("QFIX.augment.assignment"), true, true);
|
||||
}
|
||||
|
||||
public void testAugmentAssignmentPerc() { // PY-3197
|
||||
doInspectionTest("AugmentAssignmentPerc.py", PyAugmentAssignmentInspection.class,
|
||||
PyBundle.message("QFIX.augment.assignment"), true, true);
|
||||
}
|
||||
|
||||
public void testAugmentAssignment1() { // PY-5037
|
||||
doInspectionTest("AugmentAssignment1.py", PyAugmentAssignmentInspection.class,
|
||||
PyBundle.message("QFIX.augment.assignment"), true, true);
|
||||
}
|
||||
|
||||
public void testAugmentAssignment2() { // PY-6331
|
||||
doInspectionTest("AugmentAssignment2.py", PyAugmentAssignmentInspection.class,
|
||||
PyBundle.message("QFIX.augment.assignment"), true, true);
|
||||
}
|
||||
|
||||
public void testAugmentAssignmentFunction() { // PY-6678
|
||||
doInspectionTest("AugmentAssignmentFunction.py", PyAugmentAssignmentInspection.class,
|
||||
PyBundle.message("QFIX.augment.assignment"), true, true);
|
||||
}
|
||||
|
||||
public void testAugmentAssignmentSubscription() { // PY-7715
|
||||
doInspectionTest("AugmentAssignmentFunction.py", PyAugmentAssignmentInspection.class,
|
||||
PyBundle.message("QFIX.augment.assignment"), true, true);
|
||||
}
|
||||
|
||||
public void testChainedComparisons() { // PY-1020
|
||||
doInspectionTest("ChainedComparisons.py", PyChainedComparisonsInspection.class,
|
||||
PyBundle.message("QFIX.chained.comparison"), true, true);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.jetbrains.python;
|
||||
package com.jetbrains.python.quickFixes;
|
||||
|
||||
import com.jetbrains.python.PyBundle;
|
||||
import com.jetbrains.python.PyQuickFixTestCase;
|
||||
import com.jetbrains.python.inspections.PyUnresolvedReferencesInspection;
|
||||
|
||||
/**
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.jetbrains.python;
|
||||
package com.jetbrains.python.quickFixes;
|
||||
|
||||
import com.jetbrains.python.PyBundle;
|
||||
import com.jetbrains.python.PyQuickFixTestCase;
|
||||
import com.jetbrains.python.inspections.PyClassHasNoInitInspection;
|
||||
import com.jetbrains.python.inspections.PyUnresolvedReferencesInspection;
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.jetbrains.python.quickFixes;
|
||||
|
||||
import com.jetbrains.python.PyQuickFixTestCase;
|
||||
import com.jetbrains.python.inspections.PyAugmentAssignmentInspection;
|
||||
|
||||
/**
|
||||
* User: ktisha
|
||||
*/
|
||||
public class PyAugmentAssignmentQuickFixTest extends PyQuickFixTestCase {
|
||||
|
||||
public void testSimple() { // PY-1415
|
||||
doInspectionTest(PyAugmentAssignmentInspection.class);
|
||||
}
|
||||
|
||||
public void testWithContext() { // PY-2481
|
||||
doInspectionTest(PyAugmentAssignmentInspection.class);
|
||||
}
|
||||
|
||||
public void testPercent() { // PY-3197
|
||||
doInspectionTest(PyAugmentAssignmentInspection.class);
|
||||
}
|
||||
|
||||
public void testDivision() { // PY-5037
|
||||
doInspectionTest(PyAugmentAssignmentInspection.class);
|
||||
}
|
||||
|
||||
public void testReferences() { // PY-6331
|
||||
doInspectionTest(PyAugmentAssignmentInspection.class);
|
||||
}
|
||||
|
||||
public void testFunction() { // PY-6678
|
||||
doInspectionTest(PyAugmentAssignmentInspection.class);
|
||||
}
|
||||
|
||||
public void testSubscription() { // PY-7715
|
||||
doInspectionTest(PyAugmentAssignmentInspection.class);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.jetbrains.python;
|
||||
package com.jetbrains.python.quickFixes;
|
||||
|
||||
import com.jetbrains.python.PyBundle;
|
||||
import com.jetbrains.python.PyQuickFixTestCase;
|
||||
import com.jetbrains.python.inspections.PyMethodMayBeStaticInspection;
|
||||
|
||||
/**
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.jetbrains.python;
|
||||
package com.jetbrains.python.quickFixes;
|
||||
|
||||
import com.jetbrains.python.PyBundle;
|
||||
import com.jetbrains.python.PyQuickFixTestCase;
|
||||
import com.jetbrains.python.inspections.PyMethodMayBeStaticInspection;
|
||||
|
||||
/**
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.jetbrains.python;
|
||||
package com.jetbrains.python.quickFixes;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import com.jetbrains.python.PyBundle;
|
||||
import com.jetbrains.python.PyQuickFixTestCase;
|
||||
import com.jetbrains.python.inspections.PyAttributeOutsideInitInspection;
|
||||
|
||||
/**
|
||||
Reference in New Issue
Block a user