fixed PY-11277 Python: Wrong "argument equals default" inspection

This commit is contained in:
Ekaterina Tuzova
2014-01-23 18:56:05 +04:00
parent a5fc7efeec
commit 36d507f809
2 changed files with 10 additions and 0 deletions
@@ -131,6 +131,10 @@ public class PyArgumentEqualDefaultInspection extends PyInspection {
if (key.getText().equals(defaultValue.getText()))
return true;
}
if (key instanceof PyBinaryExpression && defaultValue instanceof PyBinaryExpression) {
if (key.getText().equals(defaultValue.getText()))
return true;
}
else if (key instanceof PyStringLiteralExpression && defaultValue instanceof PyStringLiteralExpression) {
if (((PyStringLiteralExpression)key).getStringValue().equals(((PyStringLiteralExpression)defaultValue).getStringValue()))
return true;
@@ -67,3 +67,9 @@ kw['customerPaymentProfileId'] = kw.get("customerPaymentProfileId",
{1: 2}.get('foo', None) #pass
{1: 2}.pop('foo', None) #pass
def a(foo=1*1024):
print foo
a( 1024*1024)