mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 17:03:12 +07:00
tests are closer to working condition
This commit is contained in:
@@ -19,7 +19,6 @@ import com.jetbrains.python.psi.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -175,6 +174,7 @@ public class PyPsiUtils {
|
||||
* @param element
|
||||
* @return
|
||||
*/
|
||||
@NotNull
|
||||
public static PyElement preprocessElement(final PsiElement element) {
|
||||
final int indentLength = getElementIndentation(element);
|
||||
final String indentString = StringUtil.repeatSymbol(' ', indentLength);
|
||||
@@ -192,6 +192,11 @@ public class PyPsiUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
return PythonLanguage.getInstance().getElementGenerator().createFromText(element.getProject(), PyElement.class, builder.toString());
|
||||
final PyElementGenerator elementGenerator = PythonLanguage.getInstance().getElementGenerator();
|
||||
final PyElement result = elementGenerator.createFromText(element.getProject(), PyElement.class, builder.toString());
|
||||
if (result == null) {
|
||||
throw new RuntimeException("Failed to create element from text " + builder.toString());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@
|
||||
package com.jetbrains.python.psi.impl;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiWhiteSpace;
|
||||
@@ -25,12 +24,10 @@ import com.intellij.psi.ResolveState;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.jetbrains.python.PythonLanguage;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import com.jetbrains.python.PyElementTypes;
|
||||
import com.jetbrains.python.psi.PyElementVisitor;
|
||||
import com.jetbrains.python.PythonLanguage;
|
||||
import com.jetbrains.python.psi.*;
|
||||
import com.jetbrains.python.psi.PyStatementList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -118,16 +115,18 @@ public class PyStatementListImpl extends PyElementImpl implements PyStatementLis
|
||||
return super.addAfter(element, anchor);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
/**
|
||||
* Indents given element and creates pair of indented psiElement and psiWhitespace(indent)
|
||||
*/
|
||||
@Nullable
|
||||
private PsiElement preprocessElement(PsiElement element) {
|
||||
if (element instanceof PsiWhiteSpace) return element;
|
||||
element = PyPsiUtils.preprocessElement(element);
|
||||
final PsiElement sibling = getPrevSibling();
|
||||
final String whitespace = sibling instanceof PsiWhiteSpace ? sibling.getText() : "";
|
||||
final int i = whitespace.lastIndexOf("\n");
|
||||
final int indent = i != -1 ? whitespace.length() - i - 1 : 0;
|
||||
if (indent == 0) return element;
|
||||
try {
|
||||
final String newElementText = StringUtil.shiftIndentInside(element.getText(), indent, false);
|
||||
final PyClass clazzz = PythonLanguage.getInstance().getElementGenerator().
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package com.jetbrains.python;
|
||||
|
||||
import com.jetbrains.python.refactoring.PyExtractMethodTest;
|
||||
import com.jetbrains.python.refactoring.PyRenameTest;
|
||||
import com.jetbrains.python.refactoring.classes.PyExtractSuperclassTest;
|
||||
import com.jetbrains.python.refactoring.classes.PyPullUpTest;
|
||||
import com.jetbrains.python.refactoring.classes.PyPushDownTest;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
/**
|
||||
@@ -32,7 +36,12 @@ public class PythonAllTestsSuite {
|
||||
PyQuickFixTest.class,
|
||||
PySelectWordTest.class,
|
||||
PySurroundWithTest.class,
|
||||
PyPullUpTest.class
|
||||
PyEditingTest.class,
|
||||
PyRenameTest.class,
|
||||
PyExtractMethodTest.class,
|
||||
PyPullUpTest.class,
|
||||
PyPushDownTest.class,
|
||||
PyExtractSuperclassTest.class
|
||||
};
|
||||
|
||||
public static TestSuite suite() {
|
||||
|
||||
Reference in New Issue
Block a user