[Python-Dev] PEP 246, redux

Jim Fulton jim at zope.com
Wed Jan 12 13:45:50 CET 2005


Clark C. Evans wrote:
> On Tue, Jan 11, 2005 at 12:54:36PM -0500, Phillip J. Eby wrote:
...
> | * In my experience, incorrectly deriving an interface from another is the 
> | most common source of unintended adaptation side-effects, not adapter 
> | composition
> 
> It'd be nice if interfaces had a way to specify a test-suite that
> could be run against a component which claims to be compliant.   For
> example, it could provide invalid inputs and assert that the proper
> errors are returned, etc.

We've tried this in Zope 3 with very limited success.  In fact,
so far, our attempts have provided more pain than their worth.
The problem is that interfaces are usually abstract enough that
it's very difficult to write generic tests.  For example,
many objects implement mapping protocols, but place restrictions
on the values stored.  It's hard to provide generic tests that don't
require lots of inconvenient hooks.  There are exceptions of course.
Our ZODB storage tests use a generic storage-interface test, but this
is possible because the ZODB storage interfaces are extremely
concrete.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org



More information about the Python-Dev mailing list