Fix PY-20876 'Replace with str.format method call' is messed up with sets

This commit is contained in:
Valentina Kiryushkina
2016-09-28 14:36:09 +03:00
parent 9dea66d46b
commit 2262e51fa9
4 changed files with 10 additions and 5 deletions
@@ -304,10 +304,8 @@ public class ConvertFormatOperatorToMethodIntention extends BaseIntentionAction
}
}
}
else if (rhsType instanceof PyCollectionType) {
if ("dict".equals(rhsType.getName())) {
target.append("(**").append(paramText).append(")");
}
else if (rhsType instanceof PyCollectionType && "dict".equals(rhsType.getName())) {
target.append("(**").append(paramText).append(")");
}
else target.append("(").append(paramText).append(")"); // tuple is ok as is
// Correctly handle multiline implicitly concatenated string literals (PY-9176)
@@ -0,0 +1 @@
print('%s' <caret>% {1, 2})
@@ -0,0 +1 @@
print('{}'.format({1, 2}))
@@ -82,5 +82,10 @@ public class PyConvertFormatOperatorToMethodIntentionTest extends PyIntentionTes
// PY-20803
public void testStarWidthPrecision() {
doNegativeTest(PyBundle.message("INTN.replace.with.method"));
}
}
// PY-20876
public void testSet() {
doTest(PyBundle.message("INTN.replace.with.method"), LanguageLevel.PYTHON26);
}
}