diff --git a/python/testData/inspections/PyTupleAssignmentBalanceInspection/expected.xml b/python/testData/inspections/PyTupleAssignmentBalanceInspection/expected.xml deleted file mode 100644 index bb2b0c02c671..000000000000 --- a/python/testData/inspections/PyTupleAssignmentBalanceInspection/expected.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - test.py - 1 - Too many values to unpack - - - test.py - 2 - Need more values to unpack - - - test.py - 5 - Need more values to unpack - - diff --git a/python/testData/inspections/PyTupleAssignmentBalanceInspection/src/test.py b/python/testData/inspections/PyTupleAssignmentBalanceInspection/src/test.py deleted file mode 100644 index c475dcd403fe..000000000000 --- a/python/testData/inspections/PyTupleAssignmentBalanceInspection/src/test.py +++ /dev/null @@ -1,5 +0,0 @@ -a, b, c = 1, 2, 3, 4 -a, b, c = foo, bar -a, b, c, d = 1, 2, 3, 4 -a = 1, 2, 3, 4 -a, b, c = 2 \ No newline at end of file diff --git a/python/testData/inspections/PyTupleAssignmentBalanceInspection/test.py b/python/testData/inspections/PyTupleAssignmentBalanceInspection/test.py new file mode 100644 index 000000000000..215a1180493c --- /dev/null +++ b/python/testData/inspections/PyTupleAssignmentBalanceInspection/test.py @@ -0,0 +1,5 @@ +a, b, c = 1, 2, 3, 4 +a, b, c = foo, bar +a, b, c, d = 1, 2, 3, 4 +a = 1, 2, 3, 4 +a, b, c = 2 \ No newline at end of file diff --git a/python/testData/inspections/PyTupleAssignmentBalanceInspection2/expected.xml b/python/testData/inspections/PyTupleAssignmentBalanceInspection2/expected.xml deleted file mode 100644 index 4ca99d889b2b..000000000000 --- a/python/testData/inspections/PyTupleAssignmentBalanceInspection2/expected.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - test.py - 1 - Too many values to unpack - - - test.py - 2 - Need more values to unpack - - - test.py - 5 - Need more values to unpack - - - test.py - 8 - Need more values to unpack - - - test.py - 10 - Only one starred expression allowed in assignment - - diff --git a/python/testData/inspections/PyTupleAssignmentBalanceInspection2/src/test.py b/python/testData/inspections/PyTupleAssignmentBalanceInspection2/src/test.py deleted file mode 100644 index 3f9ddd5e6b6e..000000000000 --- a/python/testData/inspections/PyTupleAssignmentBalanceInspection2/src/test.py +++ /dev/null @@ -1,10 +0,0 @@ -a, b, c = 1, 2, 3, 4 -a, b, c = foo, bar -a, b, c, d = 1, 2, 3, 4 -a = 1, 2, 3, 4 -a, b, c = 2 -*a, b = 1, 2, 3 -*a, b, c = 1, 2 -b, c, *a, d = 1, 2 -*a, b = 1, 2 -a, *b, c, *d = 1, 2, 3, 4, 5, 6 \ No newline at end of file diff --git a/python/testData/inspections/PyTupleAssignmentBalanceInspection2/test.py b/python/testData/inspections/PyTupleAssignmentBalanceInspection2/test.py new file mode 100644 index 000000000000..ee978cb01b67 --- /dev/null +++ b/python/testData/inspections/PyTupleAssignmentBalanceInspection2/test.py @@ -0,0 +1,21 @@ +a, b, c = (1, 2, 3, 4) + +#PY-4357 +c = 1, 2, 3 +a, b = c + +#PY-4360 +(a, b) = 1, 2, 3 +(a, b) = (1, 2, 3) + +#PY-4358 +a, b = [1, 2, 3] +a, b = 'str' +a, b = {1, 2, 3} +a, b = {1:2, 2: 3, 3:4} + +# PY-6315 +def test_tuple_slice(): + def f(): + return 1, 2, 3 + x, y = f()[:2] diff --git a/python/testData/inspections/PyTupleAssignmentBalanceInspection3/test.py b/python/testData/inspections/PyTupleAssignmentBalanceInspection3/test.py index ee978cb01b67..a0c6f9553329 100644 --- a/python/testData/inspections/PyTupleAssignmentBalanceInspection3/test.py +++ b/python/testData/inspections/PyTupleAssignmentBalanceInspection3/test.py @@ -1,21 +1,10 @@ -a, b, c = (1, 2, 3, 4) - -#PY-4357 -c = 1, 2, 3 -a, b = c - -#PY-4360 -(a, b) = 1, 2, 3 -(a, b) = (1, 2, 3) - -#PY-4358 -a, b = [1, 2, 3] -a, b = 'str' -a, b = {1, 2, 3} -a, b = {1:2, 2: 3, 3:4} - -# PY-6315 -def test_tuple_slice(): - def f(): - return 1, 2, 3 - x, y = f()[:2] +a, b, c = 1, 2, 3, 4 +a, b, c = foo, bar +a, b, c, d = 1, 2, 3, 4 +a = 1, 2, 3, 4 +a, b, c = 2 +*a, b = 1, 2, 3 +*a, b, c = 1, 2 +b, c, *a, d = 1, 2 +*a, b = 1, 2 +a, *b, c, *d = 1, 2, 3, 4, 5, 6 \ No newline at end of file diff --git a/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java b/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java index 5fd58dbc787c..d2725abb33e3 100644 --- a/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java +++ b/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. + * 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. @@ -133,13 +133,15 @@ public class PythonInspectionsTest extends PyTestCase { } public void testPyTupleAssignmentBalanceInspection() { - LocalInspectionTool inspection = new PyTupleAssignmentBalanceInspection(); - doTest(getTestName(false), inspection); + doHighlightingTest(PyTupleAssignmentBalanceInspection.class); } public void testPyTupleAssignmentBalanceInspection2() { - LocalInspectionTool inspection = new PyTupleAssignmentBalanceInspection(); - doTestWithPy3k(getTestName(false), inspection); + doHighlightingTest(PyTupleAssignmentBalanceInspection.class, LanguageLevel.PYTHON27); + } + + public void testPyTupleAssignmentBalanceInspection3() { + doHighlightingTest(PyTupleAssignmentBalanceInspection.class, LanguageLevel.PYTHON30); } public void testPyClassicStyleClassInspection() { @@ -295,16 +297,6 @@ public class PythonInspectionsTest extends PyTestCase { doHighlightingTest(PyDictDuplicateKeysInspection.class); } - - public void testPyTupleAssignmentBalanceInspection3() { - try { - setLanguageLevel(LanguageLevel.PYTHON27); - doHighlightingTest(PyTupleAssignmentBalanceInspection.class); - } finally { - setLanguageLevel(null); - } - } - public void testPyListCreationInspection() { //PY-2823 doHighlightingTest(PyListCreationInspection.class); }