mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-03 15:50:52 +07:00
PY-34493 Don't copy annotations from .pyi stubs and libraries on super method completion
GitOrigin-RevId: 65787827f5df5aa80986107dda0ba555b0942d40
This commit is contained in:
committed by
intellij-monorepo-bot
parent
dac1ef32bb
commit
b50c617b7c
@@ -328,7 +328,7 @@ public abstract class PythonCommonCompletionTest extends PythonCommonTestCase {
|
||||
}
|
||||
|
||||
public void testSuperMethodWithAnnotation() {
|
||||
doTest();
|
||||
runWithLanguageLevel(LanguageLevel.getLatest(), this::doTest);
|
||||
}
|
||||
|
||||
public void testSuperMethodWithCommentAnnotation() {
|
||||
@@ -340,6 +340,33 @@ public abstract class PythonCommonCompletionTest extends PythonCommonTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-34493
|
||||
public void testSuperMethodAnnotationsNotCopiedFromPyiStub() {
|
||||
doMultiFileTest();
|
||||
}
|
||||
|
||||
// PY-34493
|
||||
public void testSuperMethodAnnotationsNotCopiedFromThirdPartyLibrary() {
|
||||
runWithLanguageLevel(LanguageLevel.getLatest(), () -> {
|
||||
runWithAdditionalClassEntryInSdkRoots(getTestName(true) + "/lib", () -> {
|
||||
myFixture.copyDirectoryToProject(getTestName(true) + "/src", "");
|
||||
myFixture.configureByFile("a.py");
|
||||
myFixture.completeBasic();
|
||||
myFixture.checkResultByFile(getTestName(true) + "/src/a.after.py");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// PY-34493
|
||||
public void testSuperMethodAnnotationsCopiedFromPyiStubToPyiStub() {
|
||||
runWithLanguageLevel(LanguageLevel.getLatest(), () -> {
|
||||
myFixture.copyDirectoryToProject(getTestName(true), "");
|
||||
myFixture.configureByFile("a.pyi");
|
||||
myFixture.complete(CompletionType.BASIC, 1);
|
||||
myFixture.checkResultByFile(getTestName(true) + "/a.after.pyi");
|
||||
});
|
||||
}
|
||||
|
||||
public void testLocalVarInDictKey() { // PY-2558
|
||||
doTest();
|
||||
}
|
||||
@@ -2076,7 +2103,8 @@ public abstract class PythonCommonCompletionTest extends PythonCommonTestCase {
|
||||
});
|
||||
}
|
||||
|
||||
protected String getTestDataPath() {
|
||||
return PythonTestUtil.getTestDataPath() + "/completion";
|
||||
@Override
|
||||
protected @NotNull String getTestDataPath() {
|
||||
return super.getTestDataPath() + "/completion";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,12 +6,14 @@ import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.SdkModificator;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.StandardFileSystems;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.jetbrains.python.PythonLanguage;
|
||||
import com.jetbrains.python.PythonTestUtil;
|
||||
import com.jetbrains.python.documentation.PyDocumentationSettings;
|
||||
import com.jetbrains.python.documentation.docstrings.DocStringFormat;
|
||||
import com.jetbrains.python.psi.LanguageLevel;
|
||||
@@ -365,6 +367,13 @@ public abstract class PythonCommonTestCase extends TestCase {
|
||||
runWithAdditionalRoot(sdk, directory, OrderRootType.CLASSES, (__) -> runnable.run());
|
||||
}
|
||||
|
||||
protected void runWithAdditionalClassEntryInSdkRoots(@NotNull String relativeTestDataPath, @NotNull Runnable runnable) {
|
||||
final String absPath = getTestDataPath() + "/" + relativeTestDataPath;
|
||||
final VirtualFile testDataDir = StandardFileSystems.local().findFileByPath(absPath);
|
||||
assertNotNull("Additional class entry directory '" + absPath + "' not found", testDataDir);
|
||||
runWithAdditionalClassEntryInSdkRoots(testDataDir, runnable);
|
||||
}
|
||||
|
||||
private static void runWithAdditionalRoot(@NotNull Sdk sdk,
|
||||
@NotNull VirtualFile root,
|
||||
@NotNull OrderRootType rootType,
|
||||
@@ -387,4 +396,8 @@ public abstract class PythonCommonTestCase extends TestCase {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected @NotNull String getTestDataPath() {
|
||||
return PythonTestUtil.getTestDataPath();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user