mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-21161 Check that index inside .format() chunk doesn't contain quotes it will be wrapped into
This commit is contained in:
+1
-1
@@ -366,7 +366,7 @@ public class PyConvertToFStringIntention extends PyBaseIntentionAction {
|
||||
continue;
|
||||
}
|
||||
final char quote = invertQuote(hostStringQuote);
|
||||
if (indexText.indexOf('\'') >= 0 && indexText.indexOf(quote) >= 0) {
|
||||
if (indexText.indexOf(hostStringQuote) >= 0 || indexText.indexOf(quote) >= 0) {
|
||||
return null;
|
||||
}
|
||||
escaped.add("[" + quote + indexText + quote + "]");
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
'{foo["]}'.format(foo=undefined)
|
||||
+1
@@ -0,0 +1 @@
|
||||
'{foo["]}'.format(foo=undefined)
|
||||
@@ -96,6 +96,10 @@ public class PyConvertToFStringIntentionTest extends PyIntentionTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testFormatMethodIndexContainsHostAlternativeQuote() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testPercentOperatorWidthAndPrecision() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user