mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fix tests
This commit is contained in:
committed by
Valentina Kiryushkina
parent
ed6c1d127d
commit
78d9f96481
@@ -321,14 +321,14 @@ public class PySubstitutionChunkReference extends PsiReferenceBase<PyStringLiter
|
||||
for (PyExpression element : elements) {
|
||||
if (element instanceof PyStarExpression) {
|
||||
if (!LanguageLevel.forElement(element).isAtLeast(LanguageLevel.PYTHON35)) continue;
|
||||
final PyExpression underStarExpr = ((PyStarExpression)element).getExpression();
|
||||
final PyExpression underStarExpr = PyPsiUtils.flattenParens(((PyStarExpression)element).getExpression());
|
||||
if (PyUtil.instanceOf(underStarExpr, PyListLiteralExpression.class, PyTupleExpression.class)) {
|
||||
PyExpression[] subsequenсeElements = getElementsFromListOrTuple(underStarExpr);
|
||||
int subsequenceElementIndex = index - seenElementsNumber;
|
||||
if (subsequenceElementIndex < subsequenсeElements.length) {
|
||||
return Ref.create(subsequenсeElements[subsequenceElementIndex]);
|
||||
}
|
||||
if (noElementsForSure) noElementsForSure = Arrays.stream(subsequenсeElements).anyMatch(it -> it instanceof PyStarExpression);
|
||||
if (noElementsForSure) noElementsForSure = Arrays.stream(subsequenсeElements).noneMatch(it -> it instanceof PyStarExpression);
|
||||
seenElementsNumber += subsequenсeElements.length;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
"{3}".format(*[1, 2, *[3, 4]])
|
||||
"{4}".format(*[1, 2, *[3, 4]])
|
||||
<warning descr="Too few arguments for format string">"{4}"</warning>.format(*[1, 2, *[3, 4]])
|
||||
@@ -0,0 +1,2 @@
|
||||
"{2}".format(*(1, 2, *[3, 4]))
|
||||
<warning descr="Too few arguments for format string">"{4}"</warning>.format(*(1, 2, *[3, 4]))
|
||||
@@ -1,2 +1,2 @@
|
||||
"{3}".format(*[1, 2, *(3, 4)])
|
||||
"{4}".format(*[1, 2, *(3, 4)])
|
||||
<warning descr="Too few arguments for format string">"{4}"</warning>.format(*[1, 2, *(3, 4)])
|
||||
@@ -1,2 +1,2 @@
|
||||
"{3}".format(*(1, 2, *(3, 4)))
|
||||
"{4}".format(*(1, 2, *(3, 4)))
|
||||
<warning descr="Too few arguments for format string">"{4}"</warning>.format(*(1, 2, *(3, 4)))
|
||||
@@ -65,6 +65,9 @@ public class Py3StringFormatInspectionTest extends PyTestCase {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON35, this::doTest);
|
||||
}
|
||||
|
||||
public void testPackedListInsideTuple() {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON35, this::doTest);
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
myFixture.configureByFile(TEST_DIRECTORY + getTestName(false) + ".py");
|
||||
|
||||
Reference in New Issue
Block a user