Does Class implements Interface?
zvezdan at zope.com
Fri Aug 28 15:12:29 CEST 2009
On Aug 27, 2009, at 9:16 AM, Emanuele D'Arrigo wrote:
> Are there resources such as tools, recipes, documents or strategies
> that could help me deal with these issues? I've already looked into
> the ABC module and the zope.interface. I'm just fishing for more
> things to look at.
You say above that you looked at zope.interface.
Did you look at zope.interface.verify?
Specifically, verify.txt doctests state that:
"An object provides an interface if
- either its class declares that it implements the interfaces,
or the object declares that it directly provides the interface
- the object defines all the methods required by the interface
- all the methods have the correct signature
- the object defines all non-method attributes required by the
zope.interface.verify.verifyObject(I, obj) will check all of the above.
Similarly, zope.interface.verify.verifyClass(I, C) will check the class.
It is a good practice to call these functions in the regression tests.
If this is not what you are looking for, sorry for the noise.
More information about the Python-list