fixed testdata

This commit is contained in:
Ekaterina Tuzova
2012-04-23 16:41:52 +04:00
parent 1c7a09b0ef
commit 4659d71bc1
36 changed files with 95 additions and 95 deletions
@@ -3,4 +3,4 @@ def foo(a, b = 345, c = 1):
#PY-3261
foo(1,
<warning descr="Argument equals to default parameter value">345<caret></warning>, c=22)
<weak_warning descr="Argument equals to default parameter value">345<caret></weak_warning>, c=22)
@@ -1 +1 @@
<warning descr="Assignment can be replaced with augmented assignment">var = <caret>var + 3</warning>
<weak_warning descr="Assignment can be replaced with augmented assignment">var = <caret>var + 3</weak_warning>
@@ -1,2 +1,2 @@
exp = 2
<warning descr="Assignment can be replaced with augmented assignment">value = value <caret>/ (10**exp) #comment</warning>
<weak_warning descr="Assignment can be replaced with augmented assignment">value = value <caret>/ (10**exp) #comment</weak_warning>
@@ -1 +1 @@
<warning descr="Assignment can be replaced with augmented assignment">request = request + " FROM bugs WHERE bug_id = %s" % (str(bug_id))</warning>
<weak_warning descr="Assignment can be replaced with augmented assignment">request = request + " FROM bugs WHERE bug_id = %s" % (str(bug_id))</weak_warning>
@@ -1,4 +1,4 @@
class A:
x = 3
a = A()
<warning descr="Assignment can be replaced with augmented assignment">a.x = a.x +<caret> 1</warning>
<weak_warning descr="Assignment can be replaced with augmented assignment">a.x = a.x +<caret> 1</weak_warning>
@@ -1,2 +1,2 @@
if <warning descr="Simplify chained comparison">b >= <caret>a > e and b < c <= d</warning>:
if <weak_warning descr="Simplify chained comparison">b >= <caret>a > e and b < c <= d</weak_warning>:
print "q"
@@ -1,2 +1,2 @@
if <warning descr="Simplify chained comparison">b >= <caret>a > e and c < b</warning>:
if <weak_warning descr="Simplify chained comparison">b >= <caret>a > e and c < b</weak_warning>:
print "q"
@@ -1,2 +1,2 @@
if <warning descr="Simplify chained comparison">e >= <caret>a > b and c < b</warning>:
if <weak_warning descr="Simplify chained comparison">e >= <caret>a > b and c < b</weak_warning>:
print "q"
@@ -1 +1 @@
a = <warning descr="Simplify chained comparison">0 <= <caret>x < top and 0 <= y < top</warning>
a = <weak_warning descr="Simplify chained comparison">0 <= <caret>x < top and 0 <= y < top</weak_warning>
@@ -1 +1 @@
<warning descr="Simplify chained comparison">a < b <caret>and b < c</warning>
<weak_warning descr="Simplify chained comparison">a < b <caret>and b < c</weak_warning>
@@ -1,2 +1,2 @@
if <warning descr="Comparison with None performed with equality operators"><caret>a != None</warning>:
if <weak_warning descr="Comparison with None performed with equality operators"><caret>a != None</weak_warning>:
pass
@@ -1,4 +1,4 @@
def foo():
<warning descr="Triple double-quoted strings should be used for docstrings."><caret>'''</warning>foo first line docstring
second line of docstring<warning descr="Triple double-quoted strings should be used for docstrings.">'''</warning>
<weak_warning descr="Triple double-quoted strings should be used for docstrings."><caret>'''</weak_warning>foo first line docstring
second line of docstring<weak_warning descr="Triple double-quoted strings should be used for docstrings.">'''</weak_warning>
pass
+1 -1
View File
@@ -1,4 +1,4 @@
<caret><warning descr="This dictionary creation could be rewritten as a dictionary literal">dict = {"n": "n"}</warning>
<caret><weak_warning descr="This dictionary creation could be rewritten as a dictionary literal">dict = {"n": "n"}</weak_warning>
dict["a"], dict["b"] = "a", "b"
dict["k"] = "k"
dict["j"], c = "j", 4
@@ -1,2 +1,2 @@
<caret><warning descr="This dictionary creation could be rewritten as a dictionary literal">dict = {}</warning>
<caret><weak_warning descr="This dictionary creation could be rewritten as a dictionary literal">dict = {}</weak_warning>
dict[1,2] = 3,4
@@ -1,12 +1,12 @@
""" file's docstring """
def foo(a, <warning descr="Missing parameter b in docstring"><caret>b</warning>, <warning descr="Missing parameter f in docstring">f</warning>):
def foo(a, <weak_warning descr="Missing parameter b in docstring"><caret>b</weak_warning>, <weak_warning descr="Missing parameter f in docstring">f</weak_warning>):
"""
some description
another line of description
@param a: some description
of param
@param <warning descr="Unexpected parameter c in docstring">c</warning>: another description
@param <weak_warning descr="Unexpected parameter c in docstring">c</weak_warning>: another description
of param
@return:
"""
@@ -1,12 +1,12 @@
""" file's docstring """
def foo(a, <warning descr="Missing parameter b in docstring">b</warning>, <warning descr="Missing parameter f in docstring">f</warning>):
def foo(a, <weak_warning descr="Missing parameter b in docstring">b</weak_warning>, <weak_warning descr="Missing parameter f in docstring">f</weak_warning>):
"""
some description
another line of description
@param a: some description
of param
@param <warning descr="Unexpected parameter c in docstring"><caret>c</warning>: another description
@param <weak_warning descr="Unexpected parameter c in docstring"><caret>c</weak_warning>: another description
of param
@return:
"""
@@ -1,4 +1,4 @@
""" file's docstring """
def spam(<warning descr="Missing parameter ham in docstring">ha<caret>m</warning>): # <== PyCharm suggests to apply quickfix there
def spam(<weak_warning descr="Missing parameter ham in docstring">ha<caret>m</weak_warning>): # <== PyCharm suggests to apply quickfix there
"""Docstring"""
pass
@@ -1,3 +1,3 @@
class A:
def __init__(self, <warning descr="Parameter 'foo' value is not used">f<caret>oo</warning>):
def __init__(self, <weak_warning descr="Parameter 'foo' value is not used">f<caret>oo</weak_warning>):
pass
@@ -1,3 +1,3 @@
class A:
def __init__(self, <warning descr="Parameter 'foo' value is not used">f<caret>oo=True</warning>):
def __init__(self, <weak_warning descr="Parameter 'foo' value is not used">f<caret>oo=True</weak_warning>):
pass
+1 -1
View File
@@ -1,4 +1,4 @@
<warning descr="This list creation could be rewritten as a list literal">my_<caret>list = [m]</warning>
<weak_warning descr="This list creation could be rewritten as a list literal">my_<caret>list = [m]</weak_warning>
my_list.append(1)
my_list.append(var)
my_list.append(my_list)
@@ -1,17 +1,17 @@
def foo(a, b = 345, c = 1):
pass
foo(1, <warning descr="Argument equals to default parameter value">345</warning>, 22)
foo(1, <weak_warning descr="Argument equals to default parameter value">345</weak_warning>, 22)
def foo(a = None):
pass
foo(<warning descr="Argument equals to default parameter value">a = None</warning>)
foo(<weak_warning descr="Argument equals to default parameter value">a = None</weak_warning>)
def bar(a = 2, b = 3):
pass
#PY-3260
bar(<warning descr="Argument equals to default parameter value">a = 2</warning>, <warning descr="Argument equals to default parameter value">b = 3</warning>)
bar(<weak_warning descr="Argument equals to default parameter value">a = 2</weak_warning>, <weak_warning descr="Argument equals to default parameter value">b = 3</weak_warning>)
class A:
@classmethod
@@ -20,7 +20,7 @@ class A:
a = A()
a.foo(<warning descr="Argument equals to default parameter value">1</warning>)
a.foo(<weak_warning descr="Argument equals to default parameter value">1</weak_warning>)
class C(object):
@@ -34,7 +34,7 @@ class C(object):
def delx(self):
del self._x
x = property(getx, <warning descr="Argument equals to default parameter value">None</warning>, fdel = delx, doc = "I'm the 'x' property.")
x = property(getx, <weak_warning descr="Argument equals to default parameter value">None</weak_warning>, fdel = delx, doc = "I'm the 'x' property.")
# PY-3455
@@ -52,7 +52,7 @@ class OptionParser(optparse.OptionParser):
def bar(a = "qwer"):
pass
bar(<warning descr="Argument equals to default parameter value">a = 'qwer'</warning>)
bar(<weak_warning descr="Argument equals to default parameter value">a = 'qwer'</weak_warning>)
getattr(bar, "__doc__", None) # None is not highlighted
@@ -63,7 +63,7 @@ class a:
kw = a()
kw['customerPaymentProfileId'] = kw.get("customerPaymentProfileId",
<warning descr="Argument equals to default parameter value">None</warning>)
<weak_warning descr="Argument equals to default parameter value">None</weak_warning>)
{1: 2}.get('foo', None) #pass
{1: 2}.pop('foo', None) #pass
@@ -1,30 +1,30 @@
<warning descr="Assignment can be replaced with augmented assignment">var = var * 2</warning>
<warning descr="Assignment can be replaced with augmented assignment">var_1 = var_1 + 1</warning>
<weak_warning descr="Assignment can be replaced with augmented assignment">var = var * 2</weak_warning>
<weak_warning descr="Assignment can be replaced with augmented assignment">var_1 = var_1 + 1</weak_warning>
str = "string"
<warning descr="Assignment can be replaced with augmented assignment">var_2 = var_2 + str</warning>
<weak_warning descr="Assignment can be replaced with augmented assignment">var_2 = var_2 + str</weak_warning>
var_3 = var_3
var_4 = 1
<warning descr="Assignment can be replaced with augmented assignment">var_5 = var_5 + "string"</warning>
<warning descr="Assignment can be replaced with augmented assignment">var_6 = var_6 + var_4</warning>
<weak_warning descr="Assignment can be replaced with augmented assignment">var_5 = var_5 + "string"</weak_warning>
<weak_warning descr="Assignment can be replaced with augmented assignment">var_6 = var_6 + var_4</weak_warning>
var_7 += 2
#PY-2482
<warning descr="Assignment can be replaced with augmented assignment">var = 2 + var</warning>
<weak_warning descr="Assignment can be replaced with augmented assignment">var = 2 + var</weak_warning>
# PY-2483
<warning descr="Assignment can be replaced with augmented assignment">list[0] = list[0] + 1</warning>
<weak_warning descr="Assignment can be replaced with augmented assignment">list[0] = list[0] + 1</weak_warning>
# PY-2488
<warning descr="Assignment can be replaced with augmented assignment">a = a ** 1</warning>
<weak_warning descr="Assignment can be replaced with augmented assignment">a = a ** 1</weak_warning>
<warning descr="Assignment can be replaced with augmented assignment">x = x % 3</warning>
<warning descr="Assignment can be replaced with augmented assignment">x = x | 3</warning>
<warning descr="Assignment can be replaced with augmented assignment">x = x & 3</warning>
<warning descr="Assignment can be replaced with augmented assignment">x = x ^ 3</warning>
<weak_warning descr="Assignment can be replaced with augmented assignment">x = x % 3</weak_warning>
<weak_warning descr="Assignment can be replaced with augmented assignment">x = x | 3</weak_warning>
<weak_warning descr="Assignment can be replaced with augmented assignment">x = x & 3</weak_warning>
<weak_warning descr="Assignment can be replaced with augmented assignment">x = x ^ 3</weak_warning>
#PY-2514
dy = 1 - dy
@@ -3,7 +3,7 @@ class ExceptionKlass(Exception):
try:
function_throws_exception()
except <warning descr="Too broad exception clause">Exception</warning>:
except <weak_warning descr="Too broad exception clause">Exception</weak_warning>:
pass
try:
@@ -13,7 +13,7 @@ except ExceptionKlass:
try:
function_throws_exception()
<warning descr="Too broad exception clause">except</warning>:
<weak_warning descr="Too broad exception clause">except</weak_warning>:
pass
class Exception:
@@ -1,26 +1,26 @@
<warning descr="Simplify chained comparison">a < b and b < c</warning>
<warning descr="Simplify chained comparison">b > a and b < c</warning>
<warning descr="Simplify chained comparison"><warning descr="Simplify chained comparison">a < b and b < c</warning> and c < d</warning>
if <warning descr="Simplify chained comparison">a < b and b < c</warning>:
<weak_warning descr="Simplify chained comparison">a < b and b < c</weak_warning>
<weak_warning descr="Simplify chained comparison">b > a and b < c</weak_warning>
<weak_warning descr="Simplify chained comparison"><weak_warning descr="Simplify chained comparison">a < b and b < c</weak_warning> and c < d</weak_warning>
if <weak_warning descr="Simplify chained comparison">a < b and b < c</weak_warning>:
pass
q = <warning descr="Simplify chained comparison">a < c and c < d < e</warning>
<warning descr="Simplify chained comparison"><warning descr="Simplify chained comparison">a < c and b < e and e < f</warning> and a < b and b < c</warning>
q = <weak_warning descr="Simplify chained comparison">a < c and c < d < e</weak_warning>
<weak_warning descr="Simplify chained comparison"><weak_warning descr="Simplify chained comparison">a < c and b < e and e < f</weak_warning> and a < b and b < c</weak_warning>
result = <warning descr="Simplify chained comparison">a < c and c == 4</warning>
q = <warning descr="Simplify chained comparison">a < b < c and c <= d</warning>
q = <warning descr="Simplify chained comparison">a >= b >= c and c > d</warning>
result = <weak_warning descr="Simplify chained comparison">a < c and c == 4</weak_warning>
q = <weak_warning descr="Simplify chained comparison">a < b < c and c <= d</weak_warning>
q = <weak_warning descr="Simplify chained comparison">a >= b >= c and c > d</weak_warning>
#PY-3126
if <warning descr="Simplify chained comparison">b > a and b < c</warning>:
if <weak_warning descr="Simplify chained comparison">b > a and b < c</weak_warning>:
print ("a")
if <warning descr="Simplify chained comparison">c > a and b < c</warning>:
if <weak_warning descr="Simplify chained comparison">c > a and b < c</weak_warning>:
print("b")
if <warning descr="Simplify chained comparison">a > c and b < c</warning>:
if <weak_warning descr="Simplify chained comparison">a > c and b < c</weak_warning>:
print("d")
if <warning descr="Simplify chained comparison">b >= a > e and b < c</warning>:
if <weak_warning descr="Simplify chained comparison">b >= a > e and b < c</weak_warning>:
print "q"
#PY-4624
@@ -1,4 +1,4 @@
<warning descr="This dictionary creation could be rewritten as a dictionary literal">dict = {"n": "n"}</warning>
<weak_warning descr="This dictionary creation could be rewritten as a dictionary literal">dict = {"n": "n"}</weak_warning>
dict["a"], dict["b"] = "a", "b"
dict["k"] = "k"
@@ -8,7 +8,7 @@ def foo1(a, b):
"""
pass
def foo(a, <warning descr="Missing parameter b in docstring">b</warning>, <warning descr="Missing parameter n in docstring">n</warning>):
def foo(a, <weak_warning descr="Missing parameter b in docstring">b</weak_warning>, <weak_warning descr="Missing parameter n in docstring">n</weak_warning>):
"""
@param a:
@@ -19,16 +19,16 @@ def foo(a, <warning descr="Missing parameter b in docstring">b</warning>, <warni
def foo():
"""
@param <warning descr="Unexpected parameter a in docstring">a</warning>:
@param <weak_warning descr="Unexpected parameter a in docstring">a</weak_warning>:
@return:
"""
pass
def foo(a, <warning descr="Missing parameter c in docstring">c</warning>):
def foo(a, <weak_warning descr="Missing parameter c in docstring">c</weak_warning>):
"""
@param a:
@param <warning descr="Unexpected parameter b in docstring">b</warning>:
@param <weak_warning descr="Unexpected parameter b in docstring">b</weak_warning>:
@return:
"""
pass
@@ -1,4 +1,4 @@
<warning descr="This list creation could be rewritten as a list literal">my_list = [m]</warning>
<weak_warning descr="This list creation could be rewritten as a list literal">my_list = [m]</weak_warning>
my_list.append(1)
my_list.append(var)
do_something()
@@ -1,16 +1,16 @@
if <warning descr="Remove redundant parentheses">((True or <warning descr="Remove redundant parentheses">(False)</warning>))</warning>:
if <weak_warning descr="Remove redundant parentheses">((True or <weak_warning descr="Remove redundant parentheses">(False)</weak_warning>))</weak_warning>:
pass
elif <warning descr="Remove redundant parentheses">(True)</warning>:
elif <weak_warning descr="Remove redundant parentheses">(True)</weak_warning>:
pass
while <warning descr="Remove redundant parentheses">(True)</warning>:
while <weak_warning descr="Remove redundant parentheses">(True)</weak_warning>:
pass
try:
foo()
except (<warning descr="Remove redundant parentheses">(A)</warning>):
except (<weak_warning descr="Remove redundant parentheses">(A)</weak_warning>):
pass
except <warning descr="Remove redundant parentheses">(A)</warning> :
except <weak_warning descr="Remove redundant parentheses">(A)</weak_warning> :
pass
try:
@@ -23,7 +23,7 @@ if (A and
C):
pass
if <warning descr="Remove redundant parentheses">("\n")</warning>:
if <weak_warning descr="Remove redundant parentheses">("\n")</weak_warning>:
pass
result = (
@@ -1,7 +1,7 @@
if <warning descr="Expression can be simplified">a == True</warning>:
if <warning descr="Expression can be simplified">b == False</warning>:
if <warning descr="Expression can be simplified">c != True</warning>:
if <warning descr="Expression can be simplified">d != False</warning>:
if <weak_warning descr="Expression can be simplified">a == True</weak_warning>:
if <weak_warning descr="Expression can be simplified">b == False</weak_warning>:
if <weak_warning descr="Expression can be simplified">c != True</weak_warning>:
if <weak_warning descr="Expression can be simplified">d != False</weak_warning>:
pass
if a is False:
pass
@@ -1,12 +1,12 @@
<warning descr="Triple double-quoted strings should be used for docstrings.">'''</warning>package docstring<warning descr="Triple double-quoted strings should be used for docstrings.">'''</warning>
<weak_warning descr="Triple double-quoted strings should be used for docstrings.">'''</weak_warning>package docstring<weak_warning descr="Triple double-quoted strings should be used for docstrings.">'''</weak_warning>
def foo():
<warning descr="Triple double-quoted strings should be used for docstrings.">"</warning>foo docstring<warning descr="Triple double-quoted strings should be used for docstrings.">"</warning>
<weak_warning descr="Triple double-quoted strings should be used for docstrings.">"</weak_warning>foo docstring<weak_warning descr="Triple double-quoted strings should be used for docstrings.">"</weak_warning>
pass
class Klass:
<warning descr="Triple double-quoted strings should be used for docstrings.">'</warning>class docstring\
second line<warning descr="Triple double-quoted strings should be used for docstrings.">'</warning>
<weak_warning descr="Triple double-quoted strings should be used for docstrings.">'</weak_warning>class docstring\
second line<weak_warning descr="Triple double-quoted strings should be used for docstrings.">'</weak_warning>
pass
def bar():
@@ -1,22 +1,22 @@
def foo1():
<warning descr="Local variable 'aaa' value is not used">aaa</warning> = 1 #fail
<warning descr="Local variable 'aaa' value is not used">aaa</warning> = 2 #fail
<weak_warning descr="Local variable 'aaa' value is not used">aaa</weak_warning> = 1 #fail
<weak_warning descr="Local variable 'aaa' value is not used">aaa</weak_warning> = 2 #fail
bbb = 1 #pass
<warning descr="Local variable 'bbb' value is not used">bbb</warning> += 2 #fail
<weak_warning descr="Local variable 'bbb' value is not used">bbb</weak_warning> += 2 #fail
def bar(<warning descr="Parameter 'self' value is not used">self</warning>): #fail
def bar(<weak_warning descr="Parameter 'self' value is not used">self</weak_warning>): #fail
print("Foo")
def baz(<warning descr="Parameter 'a' value is not used">a</warning>): #fail
def baz(<weak_warning descr="Parameter 'a' value is not used">a</weak_warning>): #fail
a = 12
print(a)
def boo():
<warning descr="Local variable 'k' value is not used">k</warning> = 1 #fail
<weak_warning descr="Local variable 'k' value is not used">k</weak_warning> = 1 #fail
[k for k in [1,3] if True]
<warning descr="Local variable 'i' value is not used">i</warning> = 1 #fail
<weak_warning descr="Local variable 'i' value is not used">i</weak_warning> = 1 #fail
for i in [1,2]:
print(i)
@@ -46,7 +46,7 @@ def main():
def bar(arg): #pass
foo = 1 #pass
def <warning descr="Local function 'test' is not used">test</warning>(): #fail
def <weak_warning descr="Local function 'test' is not used">test</weak_warning>(): #fail
print arg
return foo #pass
@@ -79,7 +79,7 @@ def foo():
if status is not None:
status.close()
foo = lambda <warning descr="Parameter 'x' value is not used">x</warning>: False
foo = lambda <weak_warning descr="Parameter 'x' value is not used">x</weak_warning>: False
class MySuperClass:
@@ -111,7 +111,7 @@ def test():
finally:
print v
def foo(<warning descr="Parameter 'a' value is not used">a = 123</warning>): # fail Do not use getText() as parameter name
def foo(<weak_warning descr="Parameter 'a' value is not used">a = 123</weak_warning>): # fail Do not use getText() as parameter name
pass
def loopie():
@@ -124,7 +124,7 @@ def locals_inside():
class Stat(object):
@staticmethod
def woof(<warning descr="Parameter 'dog' value is not used">dog="bark"</warning>): # fail
def woof(<weak_warning descr="Parameter 'dog' value is not used">dog="bark"</weak_warning>): # fail
pass
class A:
@@ -201,7 +201,7 @@ def f(g):
# PY-4154
def a1():
<warning descr="Local variable 'a' value is not used">a</warning> = 1 #fail
<weak_warning descr="Local variable 'a' value is not used">a</weak_warning> = 1 #fail
try:
a = 2
except Exception:
@@ -258,6 +258,6 @@ def test_same_named_variable_inside_class():
# PY-5086
def test_only_name_in_local_class():
x = 1
class <warning descr="Local class 'C' is not used">C</warning>:
class <weak_warning descr="Local class 'C' is not used">C</weak_warning>:
pass
return x
@@ -3,7 +3,7 @@ def foo():
print x
def test_vlu():
<error descr="Python version 2.6 does not support this syntax. Starred expressions are not allowed as assignment targets in Python 2">*<warning descr="Local variable 'h' value is not used">h</warning></error>, <warning descr="Local variable 't' value is not used">t</warning> = [1, 2, 3] # fail
<error descr="Python version 2.6 does not support this syntax. Starred expressions are not allowed as assignment targets in Python 2">*<weak_warning descr="Local variable 'h' value is not used">h</weak_warning></error>, <weak_warning descr="Local variable 't' value is not used">t</weak_warning> = [1, 2, 3] # fail
def test_vlu():
<error descr="Python version 2.6 does not support this syntax. Starred expressions are not allowed as assignment targets in Python 2">*h</error>, t = [1, 2, 3] # pass
@@ -1,2 +1,2 @@
if <warning descr="Remove redundant parentheses"><caret>(True)</warning>:
if <weak_warning descr="Remove redundant parentheses"><caret>(True)</weak_warning>:
pass
@@ -1,5 +1,5 @@
settings = ('foreground',)
old_value = None
if ('foreground' in settings) and <warning descr="Remove redundant parentheses"><caret>((old_value is None) or (old_value > 5))</warning>:
if ('foreground' in settings) and <weak_warning descr="Remove redundant parentheses"><caret>((old_value is None) or (old_value > 5))</weak_warning>:
pass
@@ -1,2 +1,2 @@
while <warning descr="Remove redundant parentheses">((close_hr - current_hr_it) >= .<caret>5)</warning>:
while <weak_warning descr="Remove redundant parentheses">((close_hr - current_hr_it) >= .<caret>5)</weak_warning>:
pass
@@ -1 +1 @@
if <warning descr="Expression can be simplified"><caret>b != False</warning>: pass
if <weak_warning descr="Expression can be simplified"><caret>b != False</weak_warning>: pass