mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Move PythonCompletionTest to python-psi-impl. Remove dependency on ModuleType
GitOrigin-RevId: 018c426d30d5d6d30024aea0295284f5c2b3ade1
This commit is contained in:
committed by
intellij-monorepo-bot
parent
fdd3fba978
commit
a49dde336c
+3
-2
@@ -16,6 +16,7 @@
|
||||
package com.intellij.java.psi.formatter.java;
|
||||
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import com.intellij.openapi.module.ModuleTypeId;
|
||||
import com.intellij.openapi.module.StdModuleTypes;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.psi.codeStyle.JavaCodeStyleSettings;
|
||||
@@ -34,8 +35,8 @@ public abstract class JavaFormatterTestCase extends FormatterTestCase {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected ModuleType getModuleType() {
|
||||
return StdModuleTypes.JAVA;
|
||||
protected String getModuleTypeId() {
|
||||
return ModuleTypeId.JAVA_MODULE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
*/
|
||||
package com.intellij.testFramework;
|
||||
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import com.intellij.openapi.module.StdModuleTypes;
|
||||
import com.intellij.openapi.module.ModuleTypeId;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.psi.impl.JavaPsiFacadeEx;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -42,7 +41,7 @@ public abstract class LightIdeaTestCase extends LightPlatformTestCase {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected ModuleType getModuleType() {
|
||||
return StdModuleTypes.JAVA;
|
||||
protected String getModuleTypeId() {
|
||||
return ModuleTypeId.JAVA_MODULE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.testFramework;
|
||||
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import com.intellij.openapi.module.StdModuleTypes;
|
||||
import com.intellij.openapi.module.ModuleTypeId;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
@@ -75,7 +74,7 @@ public abstract class LightJavaCodeInsightTestCase extends LightPlatformCodeInsi
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected ModuleType getModuleType() {
|
||||
return StdModuleTypes.JAVA;
|
||||
protected String getModuleTypeId() {
|
||||
return ModuleTypeId.JAVA_MODULE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-6
@@ -16,8 +16,7 @@
|
||||
package com.intellij.testFramework.fixtures;
|
||||
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import com.intellij.openapi.module.StdModuleTypes;
|
||||
import com.intellij.openapi.module.ModuleTypeId;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.ContentEntry;
|
||||
import com.intellij.openapi.roots.LanguageLevelModuleExtension;
|
||||
@@ -28,13 +27,13 @@ import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
* @author peter
|
||||
*/
|
||||
public class DefaultLightProjectDescriptor extends LightProjectDescriptor {
|
||||
@NotNull
|
||||
@Override
|
||||
public ModuleType getModuleType() {
|
||||
return StdModuleTypes.JAVA;
|
||||
public String getModuleTypeId() {
|
||||
return ModuleTypeId.JAVA_MODULE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -44,7 +44,6 @@ import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
import com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl;
|
||||
import com.intellij.openapi.module.EmptyModuleType;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import com.intellij.openapi.project.ModuleListener;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
@@ -290,7 +289,7 @@ public abstract class LightPlatformTestCase extends UsefulTestCase implements Da
|
||||
|
||||
@NotNull
|
||||
protected LightProjectDescriptor getProjectDescriptor() {
|
||||
return new SimpleLightProjectDescriptor(getModuleType(), getProjectJDK());
|
||||
return new SimpleLightProjectDescriptor(getModuleTypeId(), getProjectJDK());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -646,8 +645,8 @@ public abstract class LightPlatformTestCase extends UsefulTestCase implements Da
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected ModuleType getModuleType() {
|
||||
return EmptyModuleType.getInstance();
|
||||
protected String getModuleTypeId() {
|
||||
return EmptyModuleType.EMPTY_MODULE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -775,18 +774,18 @@ public abstract class LightPlatformTestCase extends UsefulTestCase implements Da
|
||||
}
|
||||
|
||||
private static class SimpleLightProjectDescriptor extends LightProjectDescriptor {
|
||||
@NotNull private final ModuleType myModuleType;
|
||||
@NotNull private final String myModuleTypeId;
|
||||
@Nullable private final Sdk mySdk;
|
||||
|
||||
SimpleLightProjectDescriptor(@NotNull ModuleType moduleType, @Nullable Sdk sdk) {
|
||||
myModuleType = moduleType;
|
||||
SimpleLightProjectDescriptor(@NotNull String moduleTypeId, @Nullable Sdk sdk) {
|
||||
myModuleTypeId = moduleTypeId;
|
||||
mySdk = sdk;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ModuleType getModuleType() {
|
||||
return myModuleType;
|
||||
public String getModuleTypeId() {
|
||||
return myModuleTypeId;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -802,13 +801,13 @@ public abstract class LightPlatformTestCase extends UsefulTestCase implements Da
|
||||
|
||||
SimpleLightProjectDescriptor that = (SimpleLightProjectDescriptor)o;
|
||||
|
||||
if (!myModuleType.equals(that.myModuleType)) return false;
|
||||
if (!myModuleTypeId.equals(that.myModuleTypeId)) return false;
|
||||
return areJdksEqual(that.getSdk());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return myModuleType.hashCode();
|
||||
return myModuleTypeId.hashCode();
|
||||
}
|
||||
|
||||
private boolean areJdksEqual(final Sdk newSdk) {
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.intellij.openapi.application.WriteAction;
|
||||
import com.intellij.openapi.module.EmptyModuleType;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.projectRoots.ProjectJdkTable;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
@@ -82,13 +81,13 @@ public class LightProjectDescriptor {
|
||||
//temporary workaround for IDEA-147530: otherwise if someone saved module with this name before the created module will get its settings
|
||||
FileUtil.delete(imlFile);
|
||||
}
|
||||
return ModuleManager.getInstance(project).newModule(moduleFilePath, getModuleType().getId());
|
||||
return ModuleManager.getInstance(project).newModule(moduleFilePath, getModuleTypeId());
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ModuleType getModuleType() {
|
||||
return EmptyModuleType.getInstance();
|
||||
public String getModuleTypeId() {
|
||||
return EmptyModuleType.EMPTY_MODULE;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -188,4 +187,4 @@ public class LightProjectDescriptor {
|
||||
|
||||
default void sourceRootCreated(@NotNull VirtualFile sourceRoot) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import java.util.Set;
|
||||
|
||||
public class PluginModuleType extends ModuleType<PluginModuleBuilder> {
|
||||
|
||||
@NonNls private static final String ID = "PLUGIN_MODULE";
|
||||
@NonNls public static final String ID = "PLUGIN_MODULE";
|
||||
|
||||
public PluginModuleType() {
|
||||
super(ID);
|
||||
|
||||
+2
-2
@@ -33,7 +33,7 @@ class MissingRecentApiInspectionTest : PluginModuleTestCase() {
|
||||
PsiTestUtil.addProjectLibrary(model, "kotlin-stdlib", listOf(PathUtil.getJarPathForClass(Function::class.java)))
|
||||
}
|
||||
|
||||
override fun getModuleType() = PluginModuleType.getInstance()
|
||||
override fun getModuleTypeId() = PluginModuleType.ID
|
||||
}
|
||||
|
||||
private var inspection = MissingRecentApiInspection()
|
||||
@@ -117,4 +117,4 @@ class MissingRecentApiInspectionTest : PluginModuleTestCase() {
|
||||
myFixture.testHighlighting("plugin/missingApiUsages.kt")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -31,8 +31,8 @@ public abstract class PluginModuleTestCase extends LightJavaCodeInsightFixtureTe
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ModuleType getModuleType() {
|
||||
return PluginModuleType.getInstance();
|
||||
public String getModuleTypeId() {
|
||||
return PluginModuleType.ID;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -43,6 +43,9 @@ public class PythonCodeStyleService {
|
||||
public void reparseOpenEditorFiles(@NotNull Project project) {
|
||||
}
|
||||
|
||||
public void setSpaceAroundEqInKeywordArgument(@NotNull Project project, boolean enabled) {
|
||||
}
|
||||
|
||||
public static PythonCodeStyleService getInstance() {
|
||||
return ServiceManager.getService(PythonCodeStyleService.class);
|
||||
}
|
||||
|
||||
+45
-5
@@ -15,8 +15,7 @@
|
||||
*/
|
||||
package com.jetbrains.python;
|
||||
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.SdkType;
|
||||
import com.intellij.openapi.projectRoots.*;
|
||||
import com.intellij.openapi.projectRoots.impl.MockSdk;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
@@ -25,10 +24,11 @@ import com.intellij.util.containers.MultiMap;
|
||||
import com.jetbrains.python.codeInsight.typing.PyTypeShed;
|
||||
import com.jetbrains.python.codeInsight.userSkeletons.PyUserSkeletonsUtil;
|
||||
import com.jetbrains.python.psi.LanguageLevel;
|
||||
import com.jetbrains.python.sdk.PythonSdkType;
|
||||
import com.jetbrains.python.sdk.PythonSdkUtil;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -45,7 +45,6 @@ public class PythonMockSdk {
|
||||
final String mock_path = PythonTestUtil.getTestDataPath() + "/MockSdk" + version + "/";
|
||||
|
||||
String sdkHome = new File(mock_path, "bin/python" + version).getPath();
|
||||
SdkType sdkType = PythonSdkType.getInstance();
|
||||
|
||||
MultiMap<OrderRootType, VirtualFile> roots = MultiMap.create();
|
||||
|
||||
@@ -73,9 +72,50 @@ public class PythonMockSdk {
|
||||
roots.putValue(OrderRootType.CLASSES, root);
|
||||
}
|
||||
|
||||
MockSdk sdk = new MockSdk(MOCK_SDK_NAME + " " + version, sdkHome, "Python " + version + " Mock SDK", roots, sdkType);
|
||||
MockSdk sdk = new MockSdk(MOCK_SDK_NAME + " " + version, sdkHome, "Python " + version + " Mock SDK", roots, new PyMockSdkType());
|
||||
|
||||
// com.jetbrains.python.psi.resolve.PythonSdkPathCache.getInstance() corrupts SDK, so have to clone
|
||||
return sdk.clone();
|
||||
}
|
||||
|
||||
private static class PyMockSdkType extends SdkType {
|
||||
|
||||
public PyMockSdkType() {
|
||||
super(PyNames.PYTHON_SDK_ID_NAME);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String suggestHomePath() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidSdkHome(String path) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String suggestSdkName(@Nullable String currentSdkName, String sdkHome) {
|
||||
return "Python";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public AdditionalDataConfigurable createAdditionalDataConfigurable(@NotNull SdkModel sdkModel, @NotNull SdkModificator sdkModificator) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getPresentableName() {
|
||||
return "Python";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveAdditionalData(@NotNull SdkAdditionalData additionalData, @NotNull Element additional) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-2
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.jetbrains.python;
|
||||
package com.jetbrains.python.completion;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.intellij.codeInsight.completion.CompletionType;
|
||||
@@ -11,6 +11,10 @@ import com.intellij.codeInsight.lookup.LookupElementBuilder;
|
||||
import com.intellij.openapi.vfs.StandardFileSystems;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import com.jetbrains.python.PyNames;
|
||||
import com.jetbrains.python.PythonCodeStyleService;
|
||||
import com.jetbrains.python.PythonFileType;
|
||||
import com.jetbrains.python.PythonTestUtil;
|
||||
import com.jetbrains.python.documentation.docstrings.DocStringFormat;
|
||||
import com.jetbrains.python.fixtures.PyTestCase;
|
||||
import com.jetbrains.python.psi.LanguageLevel;
|
||||
@@ -892,7 +896,7 @@ public class PythonCompletionTest extends PyTestCase {
|
||||
|
||||
// PY-15197
|
||||
public void testKeywordArgumentEqualsSignSurroundedWithSpaces() {
|
||||
getPythonCodeStyleSettings().SPACE_AROUND_EQ_IN_KEYWORD_ARGUMENT = true;
|
||||
PythonCodeStyleService.getInstance().setSpaceAroundEqInKeywordArgument(myFixture.getProject(), true);
|
||||
doTest();
|
||||
}
|
||||
|
||||
+2
-4
@@ -16,7 +16,6 @@
|
||||
package com.jetbrains.python.fixtures;
|
||||
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.ModifiableRootModel;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
@@ -25,7 +24,6 @@ import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.jetbrains.python.PythonMockSdk;
|
||||
import com.jetbrains.python.PythonModuleTypeBase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
@@ -41,8 +39,8 @@ public class PyLightProjectDescriptor extends LightProjectDescriptor {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ModuleType getModuleType() {
|
||||
return PythonModuleTypeBase.getInstance();
|
||||
public String getModuleTypeId() {
|
||||
return "EMPTY_MODULE";
|
||||
}
|
||||
|
||||
@Override
|
||||
-12
@@ -6,15 +6,9 @@ import com.google.common.collect.Lists;
|
||||
import com.intellij.application.options.CodeStyle;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupEx;
|
||||
import com.intellij.execution.actions.ConfigurationContext;
|
||||
import com.intellij.execution.actions.ConfigurationFromContext;
|
||||
import com.intellij.execution.actions.RunConfigurationProducer;
|
||||
import com.intellij.execution.configurations.RunConfiguration;
|
||||
import com.intellij.find.findUsages.CustomUsageSearcher;
|
||||
import com.intellij.find.findUsages.FindUsagesOptions;
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.idea.IdeaTestApplication;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.IdeActions;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.WriteAction;
|
||||
@@ -58,7 +52,6 @@ import com.jetbrains.python.PythonTestUtil;
|
||||
import com.jetbrains.python.documentation.PyDocumentationSettings;
|
||||
import com.jetbrains.python.documentation.PythonDocumentationProvider;
|
||||
import com.jetbrains.python.documentation.docstrings.DocStringFormat;
|
||||
import com.jetbrains.python.formatter.PyCodeStyleSettings;
|
||||
import com.jetbrains.python.psi.*;
|
||||
import com.jetbrains.python.psi.impl.PyFileImpl;
|
||||
import com.jetbrains.python.psi.impl.PythonLanguageLevelPusher;
|
||||
@@ -435,11 +428,6 @@ public abstract class PyTestCase extends UsefulTestCase {
|
||||
return getCodeStyleSettings().getCommonSettings(PythonLanguage.getInstance());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected PyCodeStyleSettings getPythonCodeStyleSettings() {
|
||||
return getCodeStyleSettings().getCustomSettings(PyCodeStyleSettings.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected CodeStyleSettings getCodeStyleSettings() {
|
||||
return CodeStyle.getSettings(myFixture.getProject());
|
||||
@@ -50,4 +50,9 @@ public class PythonCodeStyleServiceImpl extends PythonCodeStyleService {
|
||||
public void reparseOpenEditorFiles(@NotNull Project project) {
|
||||
FileContentUtil.reparseFiles(project, Collections.emptyList(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSpaceAroundEqInKeywordArgument(@NotNull Project project, boolean enabled) {
|
||||
CodeStyle.getSettings(project).getCustomSettings(PyCodeStyleSettings.class).SPACE_AROUND_EQ_IN_KEYWORD_ARGUMENT = enabled;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.intellij.psi.PsiFileSystemItem;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.jetbrains.python.codeInsight.PyCodeInsightSettings;
|
||||
import com.jetbrains.python.fixtures.PyTestCase;
|
||||
import com.jetbrains.python.formatter.PyCodeStyleSettings;
|
||||
import com.jetbrains.python.psi.PyQualifiedNameOwner;
|
||||
import com.jetbrains.python.psi.resolve.QualifiedNameFinder;
|
||||
import one.util.streamex.StreamEx;
|
||||
@@ -182,4 +183,9 @@ public class PyClassNameCompletionTest extends PyTestCase {
|
||||
return Objects.toString(QualifiedNameFinder.findShortestImportableQName(item));
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private PyCodeStyleSettings getPythonCodeStyleSettings() {
|
||||
return getCodeStyleSettings().getCustomSettings(PyCodeStyleSettings.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.jetbrains.python.codeInsight.PyCodeInsightSettings;
|
||||
import com.jetbrains.python.documentation.docstrings.DocStringFormat;
|
||||
import com.jetbrains.python.fixtures.PyTestCase;
|
||||
import com.jetbrains.python.formatter.PyCodeStyleSettings;
|
||||
import com.jetbrains.python.psi.LanguageLevel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -787,4 +788,9 @@ public class PyEditingTest extends PyTestCase {
|
||||
CodeInsightSettings.getInstance().TAB_EXITS_BRACKETS_AND_QUOTES = savedValue;
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private PyCodeStyleSettings getPythonCodeStyleSettings() {
|
||||
return getCodeStyleSettings().getCustomSettings(PyCodeStyleSettings.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,11 +12,17 @@ import com.jetbrains.python.formatter.PyCodeStyleSettings;
|
||||
import com.jetbrains.python.psi.LanguageLevel;
|
||||
import com.jetbrains.python.psi.PyElementGenerator;
|
||||
import com.jetbrains.python.psi.PyStatement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class PyFormatterTest extends PyTestCase {
|
||||
@NotNull
|
||||
private PyCodeStyleSettings getPythonCodeStyleSettings() {
|
||||
return getCodeStyleSettings().getCustomSettings(PyCodeStyleSettings.class);
|
||||
}
|
||||
|
||||
public void testBlankLineBetweenMethods() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@@ -20,9 +20,11 @@ import com.intellij.ide.DataManager;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.jetbrains.python.fixtures.PyTestCase;
|
||||
import com.jetbrains.python.formatter.PyCodeStyleSettings;
|
||||
import com.jetbrains.python.psi.LanguageLevel;
|
||||
import com.jetbrains.python.psi.PyImportStatementBase;
|
||||
import com.jetbrains.python.psi.impl.PyFileImpl;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -30,6 +32,10 @@ import java.util.List;
|
||||
* @author yole
|
||||
*/
|
||||
public class PyOptimizeImportsTest extends PyTestCase {
|
||||
@NotNull
|
||||
private PyCodeStyleSettings getPythonCodeStyleSettings() {
|
||||
return getCodeStyleSettings().getCustomSettings(PyCodeStyleSettings.class);
|
||||
}
|
||||
|
||||
public void testSimple() {
|
||||
doTest();
|
||||
|
||||
@@ -4,8 +4,12 @@ package com.jetbrains.python.intentions
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings
|
||||
import com.jetbrains.python.PyBundle
|
||||
import com.jetbrains.python.PythonTestUtil
|
||||
import com.jetbrains.python.formatter.PyCodeStyleSettings
|
||||
|
||||
class PyConvertImportIntentionTest : PyIntentionTestCase() {
|
||||
private val pythonCodeStyleSettings: PyCodeStyleSettings
|
||||
get() = codeStyleSettings.getCustomSettings(PyCodeStyleSettings::class.java)
|
||||
|
||||
override fun getTestDataPath(): String = PythonTestUtil.getTestDataPath() + "/intentions/convertImport"
|
||||
|
||||
// PY-37858
|
||||
@@ -63,4 +67,4 @@ class PyConvertImportIntentionTest : PyIntentionTestCase() {
|
||||
myFixture.launchAction(intentionAction)
|
||||
myFixture.checkResultByFile("$root/$file.after.py", true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.jetbrains.python.PyQuickFixTestCase;
|
||||
import com.jetbrains.python.codeInsight.imports.AutoImportQuickFix;
|
||||
import com.jetbrains.python.codeInsight.imports.ImportCandidateHolder;
|
||||
import com.jetbrains.python.codeInsight.imports.PythonImportUtils;
|
||||
import com.jetbrains.python.formatter.PyCodeStyleSettings;
|
||||
import com.jetbrains.python.inspections.unresolvedReference.PyUnresolvedReferencesInspection;
|
||||
import com.jetbrains.python.psi.PyReferenceExpression;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -37,6 +38,10 @@ import java.util.List;
|
||||
* @author Mikhail Golubev
|
||||
*/
|
||||
public class PyAddImportQuickFixTest extends PyQuickFixTestCase {
|
||||
@NotNull
|
||||
private PyCodeStyleSettings getPythonCodeStyleSettings() {
|
||||
return getCodeStyleSettings().getCustomSettings(PyCodeStyleSettings.class);
|
||||
}
|
||||
|
||||
// PY-19773
|
||||
public void testReexportedName() {
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.intellij.util.containers.ContainerUtil;
|
||||
import com.jetbrains.python.PythonTestUtil;
|
||||
import com.jetbrains.python.codeInsight.PyCodeInsightSettings;
|
||||
import com.jetbrains.python.fixtures.PyTestCase;
|
||||
import com.jetbrains.python.formatter.PyCodeStyleSettings;
|
||||
import com.jetbrains.python.psi.*;
|
||||
import com.jetbrains.python.psi.stubs.PyClassNameIndex;
|
||||
import com.jetbrains.python.psi.stubs.PyFunctionNameIndex;
|
||||
@@ -516,4 +517,9 @@ public class PyMoveTest extends PyTestCase {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private PyCodeStyleSettings getPythonCodeStyleSettings() {
|
||||
return getCodeStyleSettings().getCustomSettings(PyCodeStyleSettings.class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user