From 1edb242fdd08ae91ccf73362a3d79a66ae5fd7e6 Mon Sep 17 00:00:00 2001 From: Valentina Kiryushkina Date: Thu, 24 Mar 2016 19:01:35 +0300 Subject: [PATCH] In percent string resolve positional substitution on first position to non-tuple left part expression #PY-18115 --- .../PySubstitutionChunkReference.java | 38 ++++++++----------- .../percentStringWithDictCall.py | 1 + .../com/jetbrains/python/PyResolveTest.java | 6 +-- .../PyUnresolvedReferencesInspectionTest.java | 5 +++ 4 files changed, 25 insertions(+), 25 deletions(-) create mode 100644 python/testData/inspections/PyUnresolvedReferencesInspection/percentStringWithDictCall.py diff --git a/python/src/com/jetbrains/python/codeInsight/PySubstitutionChunkReference.java b/python/src/com/jetbrains/python/codeInsight/PySubstitutionChunkReference.java index a5d67047187b..71e96f63be14 100644 --- a/python/src/com/jetbrains/python/codeInsight/PySubstitutionChunkReference.java +++ b/python/src/com/jetbrains/python/codeInsight/PySubstitutionChunkReference.java @@ -56,12 +56,12 @@ public class PySubstitutionChunkReference extends PsiReferenceBase%s" % dict(), 1 \ No newline at end of file diff --git a/python/testSrc/com/jetbrains/python/PyResolveTest.java b/python/testSrc/com/jetbrains/python/PyResolveTest.java index 7ea9e3cb2ee0..a24620e2bf54 100644 --- a/python/testSrc/com/jetbrains/python/PyResolveTest.java +++ b/python/testSrc/com/jetbrains/python/PyResolveTest.java @@ -714,7 +714,7 @@ public class PyResolveTest extends PyResolveTestCase { //PY-2748 public void testPercentStringWithRefAsArgument() { PsiElement target = resolve(); - assertEquals(null, target); + assertEquals("tuple", target.getText()); } //PY-2748 @@ -744,8 +744,8 @@ public class PyResolveTest extends PyResolveTestCase { // PY-2748 public void testPercentStringPosParenDictCall() { PsiElement target = resolve(); - assertInstanceOf(target, PyReferenceExpression.class); - assertEquals("dict", ((PyReferenceExpression)target).getName()); + assertInstanceOf(target, PyCallExpression.class); + assertEquals("dict()", target.getText()); } diff --git a/python/testSrc/com/jetbrains/python/inspections/PyUnresolvedReferencesInspectionTest.java b/python/testSrc/com/jetbrains/python/inspections/PyUnresolvedReferencesInspectionTest.java index 22d73b0e1744..b50f92713753 100644 --- a/python/testSrc/com/jetbrains/python/inspections/PyUnresolvedReferencesInspectionTest.java +++ b/python/testSrc/com/jetbrains/python/inspections/PyUnresolvedReferencesInspectionTest.java @@ -667,6 +667,11 @@ public class PyUnresolvedReferencesInspectionTest extends PyInspectionTestCase { doTest(); } + // PY-18115 + public void testPercentStringWithDictCall() { + doTest(); + } + // PY-18254 public void testVarargsAnnotatedWithFunctionComment() { doTest();