fixed PY-12526 Replace with str format method call: unnecessary u prefix for python 3

This commit is contained in:
Ekaterina Tuzova
2014-04-02 15:18:58 +04:00
parent 2c66b01897
commit c25dd56396
4 changed files with 10 additions and 1 deletions
@@ -140,10 +140,11 @@ public class PyStringConcatenationToFormatIntention extends BaseIntentionAction
int paramCount = 0;
boolean isUnicode = false;
final PyClassTypeImpl unicodeType = PyBuiltinCache.getInstance(element).getObjectType("unicode");
for (PyExpression expression : getSimpleExpressions((PyBinaryExpression) element)) {
if (expression instanceof PyStringLiteralExpression) {
final PyType type = context.getType(expression);
if (PyTypeChecker.match(unicodeType, type, context)) {
if (type != null && type.equals(unicodeType)) {
isUnicode = true;
}
if (!quotesDetected) {
@@ -0,0 +1,2 @@
string = "qwer<caret>" + "asdf"
@@ -0,0 +1,2 @@
string = "qwerasdf"
@@ -73,4 +73,8 @@ public class PyStringConcatenationToFormatIntentionTest extends PyIntentionTestC
public void testPy3() { //PY-4706
doTest(PyBundle.message("INTN.replace.plus.with.str.format"), LanguageLevel.PYTHON33);
}
public void testPy3Unicode() {
doTest(PyBundle.message("INTN.replace.plus.with.str.format"), LanguageLevel.PYTHON33);
}
}