PY-41676 Fix hasattr resolve issue str object is not callable

GitOrigin-RevId: aa9583ab678dd48a9264209b9bb2545b435e9d26
This commit is contained in:
andrey.matveev
2020-04-16 13:44:07 +07:00
committed by intellij-monorepo-bot
parent a034f25ce4
commit 3055c4293a
7 changed files with 52 additions and 115 deletions

View File

@@ -1475,18 +1475,4 @@ public abstract class PyCommonResolveTest extends PyCommonResolveTestCase {
final TypeEvalContext context = TypeEvalContext.codeInsightFallback(myFixture.getProject());
assertEmpty(file.findTopLevelAttribute("t").multiResolveAssignedValue(PyResolveContext.defaultContext().withTypeEvalContext(context)));
}
// PY-10184
public void testHasattrResolveTrueIfBranch() {
PsiElement targetElement = resolve();
assertInstanceOf(targetElement, PyStringLiteralExpression.class);
assertEquals("ajjj", ((PyStringLiteralExpression)targetElement).getStringValue());
}
// PY-10184
public void testHasattrResolveConditionalExpression() {
PsiElement targetElement = resolve();
assertInstanceOf(targetElement, PyStringLiteralExpression.class);
assertEquals("fld", ((PyStringLiteralExpression)targetElement).getStringValue());
}
}