Message289682
Here's an example test that fails:
def test_isabstract_during_init_subclass(self):
from abc import ABCMeta, abstractmethod
isabstract_checks = []
class AbstractChecker(metaclass=ABCMeta):
def __init_subclass__(cls):
abstract_checks.append(inspect.isabstract(cls))
class AbstractClassExample(AbstractChecker):
@abstractmethod
def foo(self):
pass
class ClassExample(AbstractClassExample):
def foo(self):
pass
self.assertEqual(isabstract_checks, [True, False])
To run the test, you'll need to be on a version of python where bpo-29581 is fixed (e.g., a cpython branch with https://github.com/python/cpython/pull/527 merged) in order for __init_subclass__ to work with ABCMeta at all in the first place. I have a simple patch to inspect.isabstract that fixes this, and will make a PR shortly. |
|
Date |
User |
Action |
Args |
2017-03-15 17:06:09 | So8res | set | recipients:
+ So8res |
2017-03-15 17:06:09 | So8res | set | messageid: <1489597569.75.0.0334116955024.issue29822@psf.upfronthosting.co.za> |
2017-03-15 17:06:09 | So8res | link | issue29822 messages |
2017-03-15 17:06:09 | So8res | create | |
|