mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Consider class inheriting abc.ABC as abstract (PY-30789)
This commit is contained in:
@@ -60,6 +60,11 @@ public class PyAbstractClassInspection extends PyInspection {
|
||||
if (metaClass != null && PyNames.ABC_META_CLASS.equals(metaClass.getName())) {
|
||||
return true;
|
||||
}
|
||||
for (PyClassLikeType superClassType : pyClass.getSuperClassTypes(myTypeEvalContext)) {
|
||||
if (superClassType != null && "abc.ABC".equals(superClassType.getClassQName())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for (PyFunction method : pyClass.getMethods()) {
|
||||
if (PyKnownDecoratorUtil.hasAbstractDecorator(method, myTypeEvalContext)) {
|
||||
return true;
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import abc
|
||||
|
||||
class A1(abc.ABC):
|
||||
@abc.abstractmethod
|
||||
def m1(self):
|
||||
pass
|
||||
|
||||
class A2(A1, abc.ABC):
|
||||
pass
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
class ABCMeta:
|
||||
pass
|
||||
|
||||
|
||||
class ABC(metaclass=ABCMeta):
|
||||
"""Helper class that provides a standard way to create an ABC using
|
||||
inheritance.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
def abstractmethod(foo):
|
||||
pass
|
||||
@@ -34,6 +34,11 @@ public class PyAbstractClassInspectionTest extends PyInspectionTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-30789
|
||||
public void testHiddenForAbstractSubclassWithABCSuperclass() {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON34, this::doMultiFileTest);
|
||||
}
|
||||
|
||||
// PY-16776
|
||||
public void testNotImplementedOverriddenInParent() {
|
||||
doTest();
|
||||
|
||||
Reference in New Issue
Block a user