void (@Nullable String subClassName, String @NotNull ... methodNames) { TypeEvalContext typeEvalContext = TypeEvalContext.userInitiated(myFixture.getProject(), myFixture.getFile()); PyClass subClass; if (subClassName == null) { subClass = ContainerUtil.getLastItem(((PyFile)myFixture.getFile()).getTopLevelClasses()); } else { subClass = myFixture.findElementByText(subClassName, PyClass.class); } assertNotNull(subClass); List<PyFunction> methodsToOverride; if (methodNames.length == 0) { List<PyClass> ancestorClasses = subClass.getAncestorClasses(typeEvalContext); assertNotEmpty(ancestorClasses); methodsToOverride = Collections.singletonList(ancestorClasses.get(0).getMethods()[0]); } else { methodsToOverride = ContainerUtil.map(methodNames, name -> subClass.findMethodByName(name, true, typeEvalContext)); } methodsToOverride.forEach(TestCase::assertNotNull); List<PyFunction> implToOverride = ContainerUtil.map( methodsToOverride, method -> ObjectUtils.chooseNotNull(PyiUtil.getImplementation(method, typeEvalContext), method) ); PyOverrideImplementUtil.overrideMethods(myFixture.getEditor(), subClass, ContainerUtil.map(implToOverride, PyMethodMember::new), false); }