PY-40997 Use qualified function reference in the default test case

It seems that using boto3.client() is more common than just client(), and
qualifier triggers extra performance problems when we try to infer its type.

GitOrigin-RevId: 87d2abf227d91a4f18568b50e76f09ec0cea47ef
This commit is contained in:
Mikhail Golubev
2021-01-18 15:36:30 +00:00
committed by intellij-monorepo-bot
parent 45ea1b5aa1
commit b8c3db5d1b
3 changed files with 9 additions and 9 deletions
@@ -62,27 +62,27 @@ public class PyOverloadsProcessingPerformanceTest extends PyTestCase {
}
public void testComputingResultTypeWithCodeAnalysisContext() {
PyCallExpression call = configureAndGetCallExprUnderCaret("main.py");
PyCallExpression call = configureAndGetCallExprUnderCaret("mainQualified.py");
TypeEvalContext context = TypeEvalContext.codeAnalysis(myFixture.getProject(), myFixture.getFile());
assertType("int", call, context);
}
public void testComputingResultTypeWithUserInitiatedContext() {
PyCallExpression call = configureAndGetCallExprUnderCaret("main.py");
PyCallExpression call = configureAndGetCallExprUnderCaret("mainQualified.py");
TypeEvalContext context = TypeEvalContext.userInitiated(myFixture.getProject(), myFixture.getFile());
assertType("int", call, context);
}
public void testNavigatingToDefinition() {
PyCallExpression call = configureAndGetCallExprUnderCaret("main.py");
PsiElement element = GotoDeclarationAction.findTargetElement(myFixture.getProject(), myFixture.getEditor(), call.getTextOffset());
configureAndGetCallExprUnderCaret("mainQualified.py");
PsiElement element = GotoDeclarationAction.findTargetElement(myFixture.getProject(), myFixture.getEditor(), myFixture.getCaretOffset());
assertInstanceOf(element, PyFunction.class);
}
public void testQuickDocumentationRendering() {
PyCallExpression call = configureAndGetCallExprUnderCaret("main.py");
configureAndGetCallExprUnderCaret("mainQualified.py");
DocumentationProvider docProvider = new PythonDocumentationProvider();
PsiElement leaf = PsiTreeUtil.getDeepestFirst(call);
PsiElement leaf = myFixture.getFile().findElementAt(myFixture.getCaretOffset());
DocumentationManager docManager = DocumentationManager.getInstance(myFixture.getProject());
PsiElement docTarget = docManager.findTargetElement(myFixture.getEditor(), leaf.getTextOffset(), myFixture.getFile(), leaf);
doPerformanceTestResettingCaches("Rendering Quick Documentation", 100, () -> {
@@ -96,13 +96,13 @@ public class PyOverloadsProcessingPerformanceTest extends PyTestCase {
myFixture.copyDirectoryToProject("", "");
myFixture.enableInspections(PyUnresolvedReferencesInspection.class);
doPerformanceTestResettingCaches("Pass of Unresolved References inspection", 100, () -> {
myFixture.configureByFile("main.py");
myFixture.configureByFile("mainQualified.py");
myFixture.checkHighlighting();
});
}
public void testOverloadsNotDuplicatedInReferenceMultiResolveResults() {
PyCallExpression call = configureAndGetCallExprUnderCaret("main.py");
PyCallExpression call = configureAndGetCallExprUnderCaret("mainUnqualified.py");
PyReferenceExpression refExpr = assertInstanceOf(call.getCallee(), PyReferenceExpression.class);
ResolveResult[] resolveResults = refExpr.getReference().multiResolve(false);
// Overloads, lower-priority imported name and the function itself.
@@ -110,7 +110,7 @@ public class PyOverloadsProcessingPerformanceTest extends PyTestCase {
}
public void testOverloadsNotDuplicatedInQualifiedReferenceMultiResolveResults() {
PyCallExpression call = configureAndGetCallExprUnderCaret(getTestName(true) + ".py");
PyCallExpression call = configureAndGetCallExprUnderCaret("mainQualified.py");
PyReferenceExpression expr = assertInstanceOf(call.getCallee(), PyReferenceExpression.class);
ResolveResult[] resolveResults = expr.getReference().multiResolve(false);
// Overloads only.