mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Introduce separate unit test class for PyTupleAssignmentBalanceInspectionTest
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
a, b, c = <warning descr="Too many values to unpack">(1, 2, 3, 4)</warning>
|
||||
|
||||
#PY-4357
|
||||
c = 1, 2, 3
|
||||
a, b = <warning descr="Too many values to unpack">c</warning>
|
||||
|
||||
#PY-4360
|
||||
(a, b) = <warning descr="Too many values to unpack">1, 2, 3</warning>
|
||||
(a, b) = <warning descr="Too many values to unpack">(1, 2, 3)</warning>
|
||||
|
||||
#PY-4358
|
||||
a, b = <warning descr="Too many values to unpack">[1, 2, 3]</warning>
|
||||
a, b = <warning descr="Too many values to unpack">'str'</warning>
|
||||
a, b = <warning descr="Too many values to unpack">{1, 2, 3}</warning>
|
||||
a, b = <warning descr="Too many values to unpack">{1:2, 2: 3, 3:4}</warning>
|
||||
|
||||
# PY-6315
|
||||
def test_tuple_slice():
|
||||
def f():
|
||||
return 1, 2, 3
|
||||
x, y = f()[:2]
|
||||
|
||||
# PY-22224
|
||||
a, b = <warning descr="Need more values to unpack">None</warning>
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
a, b, c = <warning descr="Too many values to unpack">1, 2, 3, 4</warning>
|
||||
a, b, c = <warning descr="Too many values to unpack">(1, 2, 3, 4)</warning>
|
||||
a, b, c = <warning descr="Need more values to unpack">foo, bar</warning>
|
||||
a, b, c, d = 1, 2, 3, 4
|
||||
a = 1, 2, 3, 4
|
||||
+1
-4
@@ -7,7 +7,4 @@ a, b, c = <warning descr="Need more values to unpack">2</warning>
|
||||
*a, b, c = 1, 2
|
||||
b, c, *a, d = <warning descr="Need more values to unpack">1, 2</warning>
|
||||
*a, b = 1, 2
|
||||
<warning descr="Only one starred expression allowed in assignment">a, *b, c, *d</warning> = 1, 2, 3, 4, 5, 6
|
||||
|
||||
# PY-22224
|
||||
a, b = <warning descr="Need more values to unpack">None</warning>
|
||||
<warning descr="Only one starred expression allowed in assignment">a, *b, c, *d</warning> = 1, 2, 3, 4, 5, 6
|
||||
@@ -0,0 +1,2 @@
|
||||
c = 1, 2, 3
|
||||
a, b = <warning descr="Too many values to unpack">c</warning>
|
||||
@@ -0,0 +1,4 @@
|
||||
a, b = <warning descr="Too many values to unpack">[1, 2, 3]</warning>
|
||||
a, b = <warning descr="Too many values to unpack">'str'</warning>
|
||||
a, b = <warning descr="Too many values to unpack">{1, 2, 3}</warning>
|
||||
a, b = <warning descr="Too many values to unpack">{1:2, 2: 3, 3:4}</warning>
|
||||
@@ -0,0 +1,2 @@
|
||||
(a, b) = <warning descr="Too many values to unpack">1, 2, 3</warning>
|
||||
(a, b) = <warning descr="Too many values to unpack">(1, 2, 3)</warning>
|
||||
@@ -0,0 +1,4 @@
|
||||
def test_tuple_slice():
|
||||
def f():
|
||||
return 1, 2, 3
|
||||
x, y = f()[:2]
|
||||
@@ -0,0 +1 @@
|
||||
a, b = <warning descr="Need more values to unpack">None</warning>
|
||||
@@ -0,0 +1 @@
|
||||
a, b = <warning descr="Need more values to unpack">None</warning>
|
||||
@@ -132,18 +132,6 @@ public class PythonInspectionsTest extends PyTestCase {
|
||||
doHighlightingTest(PyDictCreationInspection.class, LanguageLevel.PYTHON26);
|
||||
}
|
||||
|
||||
public void testPyTupleAssignmentBalanceInspection() {
|
||||
doHighlightingTest(PyTupleAssignmentBalanceInspection.class);
|
||||
}
|
||||
|
||||
public void testPyTupleAssignmentBalanceInspection2() {
|
||||
doHighlightingTest(PyTupleAssignmentBalanceInspection.class, LanguageLevel.PYTHON27);
|
||||
}
|
||||
|
||||
public void testPyTupleAssignmentBalanceInspection3() {
|
||||
doHighlightingTest(PyTupleAssignmentBalanceInspection.class, LanguageLevel.PYTHON30);
|
||||
}
|
||||
|
||||
public void testPyClassicStyleClassInspection() {
|
||||
doHighlightingTest(PyClassicStyleClassInspection.class);
|
||||
}
|
||||
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.python.inspections;
|
||||
|
||||
import com.jetbrains.python.fixtures.PyTestCase;
|
||||
import com.jetbrains.python.psi.LanguageLevel;
|
||||
|
||||
public class PyTupleAssignmentBalanceInspectionTest extends PyTestCase {
|
||||
|
||||
public void testPy2() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testPy3() {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest);
|
||||
}
|
||||
|
||||
// PY-4357
|
||||
public void testPy4357() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-4360
|
||||
public void testPy4360() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-4358
|
||||
public void testPy4358() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-6315
|
||||
public void testPy6315() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-22224
|
||||
public void testUnpackNonePy2() {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON27, this::doTest);
|
||||
}
|
||||
|
||||
// PY-22224
|
||||
public void testUnpackNonePy3() {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest);
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
final String path = "inspections/PyTupleAssignmentBalanceInspectionTest/" + getTestName(true) + ".py";
|
||||
|
||||
myFixture.configureByFile(path);
|
||||
myFixture.enableInspections(PyTupleAssignmentBalanceInspection.class);
|
||||
myFixture.checkHighlighting(true, false, false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user