verifyObject doesn't correctly work on classes with classProvides
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
zope.interface |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
When for instance declaring a factory classProvides is handy at times:
>>> import zope.interface
>>> import zope.interface.
>>>
>>> class IFoo(zope.
... def __call__(arg):
... pass
...
>>> class FooOkay(object):
... zope.interface.
... def __init__(self, arg):
... pass
...
>>> zope.interface.
True
That's was working.
The next case should raise an error, but doesn't. IFoo requires an arg to be passed which the following class doesn't implement:
>>> class FooVerifiedByNo
... zope.interface.
...
>>> zope.interface.
True
The next case should actually pass but doesn't.
>>> class FooBroken(object):
... zope.interface.
... def __init__(self, arg):
... pass
... def __call__(self):
... pass
...
>>> zope.interface.
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Users/
return _verify(iface, candidate, tentative, vtype='o')
File "/Users/
raise BrokenMethodImp
BrokenMethodImp
because implementation doesn't allow enough arguments.
>>>
Apparently verifyObject doesn't take any special care for classes which proivde an interface.
Please follow up on Github:
https:/ /github. com/zopefoundat ion/zope. interface/ issues/ 15