use of com.jetbrains.python.codeInsight.override.PyMethodMember in project intellij-community by JetBrains.
the class PyImplementMethodsQuickFix method invoke.
@Override
public void invoke(@NotNull Project project, @NotNull PsiFile file, @NotNull PsiElement startElement, @NotNull PsiElement endElement) {
final Editor editor = PyQuickFixUtil.getEditor(file);
if (editor != null && startElement instanceof PyClass) {
if (ApplicationManager.getApplication().isUnitTestMode()) {
ArrayList<PyMethodMember> list = new ArrayList<>();
for (PyFunction function : myToImplement) {
list.add(new PyMethodMember(function));
}
PyOverrideImplementUtil.overrideMethods(editor, (PyClass) startElement, list, true);
} else {
PyOverrideImplementUtil.chooseAndOverrideOrImplementMethods(project, editor, (PyClass) startElement, myToImplement, "Select Methods to Implement", true);
}
}
}
use of com.jetbrains.python.codeInsight.override.PyMethodMember in project intellij-community by JetBrains.
the class PyOverrideTest method testQualified.
public void testQualified() {
// PY-2171
myFixture.configureByFile("override/" + getTestName(true) + ".py");
PyClass dateClass = PyClassNameIndex.findClass("datetime.date", myFixture.getProject());
assertNotNull(dateClass);
PyFunction initMethod = dateClass.findMethodByName(PyNames.INIT, false, null);
assertNotNull(initMethod);
PyOverrideImplementUtil.overrideMethods(myFixture.getEditor(), getTopLevelClass(0), Collections.singletonList(new PyMethodMember(initMethod)), false);
myFixture.checkResultByFile("override/" + getTestName(true) + "_after.py", true);
}
Aggregations