use of com.jetbrains.python.psi.PyFunction in project intellij-community by JetBrains.
the class PyOverrideTest method doTest.
private void doTest() {
myFixture.configureByFile("override/" + getTestName(true) + ".py");
PyFunction toOverride = getTopLevelClass(0).getMethods()[0];
PyOverrideImplementUtil.overrideMethods(myFixture.getEditor(), getTopLevelClass(1), Collections.singletonList(new PyMethodMember(toOverride)), false);
myFixture.checkResultByFile("override/" + getTestName(true) + "_after.py", true);
}
use of com.jetbrains.python.psi.PyFunction in project intellij-community by JetBrains.
the class PyOverrideTest method testInnerFunctionClass.
public void testInnerFunctionClass() {
myFixture.configureByFile("override/" + getTestName(true) + ".py");
PyFunction toOverride = getTopLevelClass(0).getMethods()[0];
final PsiElement element = myFixture.getElementAtCaret();
PyOverrideImplementUtil.overrideMethods(myFixture.getEditor(), PsiTreeUtil.getParentOfType(element, PyClass.class, false), Collections.singletonList(new PyMethodMember(toOverride)), false);
myFixture.checkResultByFile("override/" + getTestName(true) + "_after.py", true);
}
use of com.jetbrains.python.psi.PyFunction in project intellij-community by JetBrains.
the class PyOverrideTest method testInnerClass.
public void testInnerClass() {
// PY-10976
myFixture.configureByFile("override/" + getTestName(true) + ".py");
PyFunction toOverride = getTopLevelClass(0).getMethods()[0];
PyClass pyClass = getTopLevelClass(1).getNestedClasses()[0];
PyOverrideImplementUtil.overrideMethods(myFixture.getEditor(), pyClass, Collections.singletonList(new PyMethodMember(toOverride)), false);
myFixture.checkResultByFile("override/" + getTestName(true) + "_after.py", true);
}
use of com.jetbrains.python.psi.PyFunction in project intellij-community by JetBrains.
the class PyOverrideTest method testImplement.
public void testImplement() {
myFixture.configureByFile("override/" + getTestName(true) + ".py");
PyFunction toImplement = getTopLevelClass(0).getMethods()[1];
PyOverrideImplementUtil.overrideMethods(myFixture.getEditor(), getTopLevelClass(1), Collections.singletonList(new PyMethodMember(toImplement)), true);
myFixture.checkResultByFile("override/" + getTestName(true) + "_after.py", true);
}
use of com.jetbrains.python.psi.PyFunction in project intellij-community by JetBrains.
the class PyOverrideTest method testInstanceCheck.
// PY-10229
public void testInstanceCheck() {
myFixture.configureByFile("override/" + getTestName(true) + ".py");
final PyClass cls = getTopLevelClass(0);
final PyFunction method = cls.findMethodByName("__instancecheck__", true, null);
assertNotNull(method);
PyOverrideImplementUtil.overrideMethods(myFixture.getEditor(), cls, Collections.singletonList(new PyMethodMember(method)), false);
myFixture.checkResultByFile("override/" + getTestName(true) + "_after.py", true);
}
Aggregations