PY-8325 Do not reset chunk position if it was parsed

This commit is contained in:
Valentina Kiryushkina
2017-05-15 14:37:54 +03:00
parent 0676702abb
commit 77de45b0fd
3 changed files with 10 additions and 1 deletions
@@ -491,7 +491,9 @@ public class PyStringFormatInspection extends PyInspection {
as(chunks.get(i), PyStringFormatParser.NewStyleSubstitutionChunk.class);
if (chunk != null) {
chunk.setPosition(i);
if (chunk.getPosition() == null) {
chunk.setPosition(i);
}
String mappingKey = inspectNewStyleChunkAndGetMappingKey(chunk);
if (!isProblem()) {
inspectArguments(chunk, mappingKey);
@@ -0,0 +1,2 @@
<warning descr="Too few mapping keys">'Hello, {1}'</warning>.format('World')
<warning descr="Too few mapping keys">'Hello, {} {}!'</warning>.format('World')
@@ -189,6 +189,11 @@ public class PyStringFormatInspectionTest extends PyTestCase {
doTest();
}
// PY-8325
public void testTooFewMappingKeys() {
doTest();
}
// PY-20599
public void testPy3kAsciiFormatSpecifier() {
runWithLanguageLevel(LanguageLevel.PYTHON35, new Runnable() {