[Zope3-Users] Interface tests: NotImplemented or NotImplementedError

Jim Fulton jim at zope.com
Tue Oct 18 14:37:05 EDT 2005


FWIW, I consider interface tests to be a sucessful failure.
They were worth trying but are not really worth the bother
most of the time.  IMO, you should only consider them in a
case where you have an interface that you expect many implementations
of and you want to reuse tests accross the implementations.  Even then,
there's a danger that the necessary infrastructure to allow reuse will make
the tests unfathomable.

Jim

Lorenzo Gil Sanchez wrote:
> Hi everybody,
> 
> while writing my first interface test I got to the point of writing the
> makeTestObject method which should raise a not implemented error (so
> implementations of this interace should override it)
> 
> In the Zope 3 book the method is like this:
> 
> def makeTestObject(self):
>    raise NotImplemented()
> 
> but after playing a bit with the Python interpreter it says that
> NotImplemented is not callable neither an exception.
> 
> Looking in some real zope3 tests I saw another version of the method:
> 
> def makeTestObject(self):
>    raise NotImplementedError()
> 
> So I guess is a little bug in the Zope3 book. Or, Am I missing
> something?
> 
> Regards
> 
> Lorenzo Gil Sanchez
> 
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users


-- 
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 Zope3-users mailing list