def testNotImplemented(self): class C(object): pass class I(Interface): pass self.assertRaises(DoesNotImplement, verifyClass, I, C) classImplements(C, I) verifyClass(I, C)
def test_ObjectSpecification(self): c = C() directlyProvides(c, I4) self.assertEqual([i.getName() for i in providedBy(c)], ['I4', 'I31', 'I1', 'I2']) self.assertEqual([i.getName() for i in providedBy(c).flattened()], ['I4', 'I31', 'I3', 'I1', 'I2', 'Interface']) self.assert_(I1 in providedBy(c)) self.failIf(I3 in providedBy(c)) self.assert_(providedBy(c).extends(I3)) self.assert_(providedBy(c).extends(I31)) self.failIf(providedBy(c).extends(I5)) class COnly(A, B): implementsOnly(I31) class D(COnly): implements(I5) classImplements(D, I5) c = D() directlyProvides(c, I4) self.assertEqual([i.getName() for i in providedBy(c)], ['I4', 'I5', 'I31']) self.assertEqual([i.getName() for i in providedBy(c).flattened()], ['I4', 'I5', 'I31', 'I3', 'Interface']) self.failIf(I1 in providedBy(c)) self.failIf(I3 in providedBy(c)) self.assert_(providedBy(c).extends(I3)) self.failIf(providedBy(c).extends(I1)) self.assert_(providedBy(c).extends(I31)) self.assert_(providedBy(c).extends(I5)) class COnly(A, B): __implemented__ = I31 class D(COnly): implements(I5) classImplements(D, I5) c = D() directlyProvides(c, I4) self.assertEqual([i.getName() for i in providedBy(c)], ['I4', 'I5', 'I31']) self.assertEqual([i.getName() for i in providedBy(c).flattened()], ['I4', 'I5', 'I31', 'I3', 'Interface']) self.failIf(I1 in providedBy(c)) self.failIf(I3 in providedBy(c)) self.assert_(providedBy(c).extends(I3)) self.failIf(providedBy(c).extends(I1)) self.assert_(providedBy(c).extends(I31)) self.assert_(providedBy(c).extends(I5))
def test_classImplements(self): class A(Odd): implements(I3) class B(Odd): implements(I4) class C(A, B): pass classImplements(C, I1, I2) self.assertEqual([i.getName() for i in implementedBy(C)], ['I1', 'I2', 'I3', 'I4']) classImplements(C, I5) self.assertEqual([i.getName() for i in implementedBy(C)], ['I1', 'I2', 'I5', 'I3', 'I4'])
pass class IUnicodeError(IValueError): pass class IUserWarning(IWarning): pass class IZeroDivisionError(IArithmeticError): pass classImplements(ArithmeticError, IArithmeticError) classImplements(AssertionError, IAssertionError) classImplements(AttributeError, IAttributeError) classImplements(DeprecationWarning, IDeprecationWarning) classImplements(EnvironmentError, IEnvironmentError) classImplements(EOFError, IEOFError) classImplements(Exception, IException) classImplements(FloatingPointError, IFloatingPointError) classImplements(ImportError, IImportError) classImplements(IndentationError, IIndentationError) classImplements(IndexError, IIndexError) classImplements(IOError, IIOError) classImplements(KeyboardInterrupt, IKeyboardInterrupt) classImplements(KeyError, IKeyError) classImplements(LookupError, ILookupError) classImplements(MemoryError, IMemoryError)
############################################################################## # # Copyright (c) 2001, 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Zope 3's Servers This package contains generic base classes for channel-based servers, the servers themselves and helper objects, such as tasks and requests. $Id: __init__.py 25177 2004-06-02 13:17:31Z jim $ """ import asyncore from httpy._zope.server.interfaces import IDispatcher from httpy._zope.interface import classImplements # Tell the the async.dispatcher that it implements IDispatcher. classImplements(asyncore.dispatcher, IDispatcher)
isn't known, return None. Else the value returned must be a timedelta object specifying a whole number of minutes in the range -1439 to 1439 inclusive (1440 = 24*60; the magnitude of the offset must be less than one day). """ def dst(dt): """Return the daylight saving time (DST) adjustment, in minutes east of UTC, or None if DST information isn't known. """ def tzname(dt): """Return the time zone name corresponding to the datetime object as a string. """ def fromutc(dt): """Return an equivalent datetime in self's local time.""" classImplements(timedelta, ITimeDelta) classImplements(date, IDate) classImplements(datetime, IDateTime) classImplements(time, ITime) classImplements(tzinfo, ITZInfo) ## directlyProvides(timedelta, ITimeDeltaClass) ## directlyProvides(date, IDateClass) ## directlyProvides(datetime, IDateTimeClass) ## directlyProvides(time, ITimeClass)