Simplify tests for PyTupleAssignmentBalanceInspection

This commit is contained in:
Semyon Proshev
2017-02-07 14:47:03 +03:00
parent c5f4701f6c
commit 9d12b3728b
8 changed files with 43 additions and 97 deletions
@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems>
<problem>
<file>test.py</file>
<line>1</line>
<description>Too many values to unpack</description>
</problem>
<problem>
<file>test.py</file>
<line>2</line>
<description>Need more values to unpack</description>
</problem>
<problem>
<file>test.py</file>
<line>5</line>
<description>Need more values to unpack</description>
</problem>
</problems>
@@ -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
@@ -0,0 +1,5 @@
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
a, b, c = <warning descr="Need more values to unpack">2</warning>
@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems>
<problem>
<file>test.py</file>
<line>1</line>
<description>Too many values to unpack</description>
</problem>
<problem>
<file>test.py</file>
<line>2</line>
<description>Need more values to unpack</description>
</problem>
<problem>
<file>test.py</file>
<line>5</line>
<description>Need more values to unpack</description>
</problem>
<problem>
<file>test.py</file>
<line>8</line>
<description>Need more values to unpack</description>
</problem>
<problem>
<file>test.py</file>
<line>10</line>
<description>Only one starred expression allowed in assignment</description>
</problem>
</problems>
@@ -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
@@ -0,0 +1,21 @@
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]
@@ -1,21 +1,10 @@
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]
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
a, b, c = <warning descr="Need more values to unpack">2</warning>
*a, b = 1, 2, 3
*a, b, c = 1, 2
b, c, *a, d = <warning descr="Need more values to unpack">1, 2</warning>
*a, b = 1, 2
a, *b, c, <warning descr="Only one starred expression allowed in assignment">*d</warning> = 1, 2, 3, 4, 5, 6
@@ -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);
}