pkgcore/snakeoil

py3.9: AssertionError: object <class 'list'> potentially has unsupported special attributes: __class_getitem__

mgorny opened this issue · 1 comments

_______________________________________________ TestDelayedInstantiation.test_descriptor_awareness ________________________________________________

self = <test_obj.TestDelayedInstantiation object at 0x7fca03278d30>

    def test_descriptor_awareness(self):
        def assertKls(cls, ignores=(),
                      default_ignores=("__new__", "__init__", "__init_subclass__",
                                       "__getattribute__", "__class__",
                                       "__getnewargs__", "__doc__")):
            required = set(x for x in dir(cls)
                           if x.startswith("__") and x.endswith("__"))
            missing = required.difference(obj.kls_descriptors)
            missing.difference_update(obj.base_kls_descriptors)
            missing.difference_update(default_ignores)
            missing.difference_update(ignores)
            assert not missing, ("object %r potentially has unsupported special "
                                 "attributes: %s" % (cls, ', '.join(missing)))
    
        assertKls(object)
        assertKls(1)
        assertKls(object())
>       assertKls(list)

tests/module/test_obj.py:39: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class 'list'>, ignores = ()
default_ignores = ('__new__', '__init__', '__init_subclass__', '__getattribute__', '__class__', '__getnewargs__', ...)

    def assertKls(cls, ignores=(),
                  default_ignores=("__new__", "__init__", "__init_subclass__",
                                   "__getattribute__", "__class__",
                                   "__getnewargs__", "__doc__")):
        required = set(x for x in dir(cls)
                       if x.startswith("__") and x.endswith("__"))
        missing = required.difference(obj.kls_descriptors)
        missing.difference_update(obj.base_kls_descriptors)
        missing.difference_update(default_ignores)
        missing.difference_update(ignores)
>       assert not missing, ("object %r potentially has unsupported special "
                             "attributes: %s" % (cls, ', '.join(missing)))
E       AssertionError: object <class 'list'> potentially has unsupported special attributes: __class_getitem__
E       assert not {'__class_getitem__'}

tests/module/test_obj.py:33: AssertionError

Fixed when #56 was merged.