Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes
CMFPlone.tests.testInterfaces.KlassInterfaceTest Class Reference
Inheritance diagram for CMFPlone.tests.testInterfaces.KlassInterfaceTest:
Inheritance graph
[legend]
Collaboration diagram for CMFPlone.tests.testInterfaces.KlassInterfaceTest:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def interfaceImplementedBy
def interfaceProvidedBy
def getImplementedBy
def getProvidedBy
def doesImplementedBy
def doesProvidedBy
def interfaceImplementedByInstanceOf
def interfaceImplementedBy
def getImplementsOfInstanceOf
def getImplementsOf
def doesImplementByInstanceOf
def doesImplementBy

Static Public Attributes

 klass = klass
 forcedImpl = forcedImpl
 instance = None
 instance = None

Detailed Description

implementation for %s 

Definition at line 333 of file testInterfaces.py.


Member Function Documentation

def CMFPlone.tests.testInterfaces.InterfaceTest.doesImplementBy (   self,
  instance,
  interfaces 
) [inherited]
make sure that the klass implements at least these interfaces

Definition at line 158 of file testInterfaces.py.

00158 
00159     def doesImplementBy(self, instance, interfaces):
00160         """ make sure that the klass implements at least these interfaces"""
00161         if type(interfaces) is not TupleType:
00162             interfaces = (interfaces)
00163         impl = self.getImplementsOf(instance)
00164         for interface in interfaces:
00165             self.failUnless(
00166                 interface in impl,
00167                 'The instance of %s does not implement %s' % (dottedName(instance),
00168                                                               dottedName(interface)))

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.tests.testInterfaces.InterfaceTest.doesImplementByInstanceOf (   self,
  klass,
  interfaces 
) [inherited]
make sure that the klass implements at least these interfaces

Definition at line 147 of file testInterfaces.py.

00147 
00148     def doesImplementByInstanceOf(self, klass, interfaces):
00149         """ make sure that the klass implements at least these interfaces"""
00150         if type(interfaces) is not TupleType:
00151             interfaces = (interfaces)
00152         impl = self.getImplementsOfInstanceOf(klass)
00153         for interface in interfaces:
00154             self.failUnless(
00155                 interface in impl,
00156                 'The class %s does not implement %s' % (dottedName(klass),
00157                                                         dottedName(interface)))

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.tests.testInterfaces.zope_interface_test.doesImplementedBy (   self,
  klass,
  interfaces 
) [inherited]
make sure that the klass implements at least these interfaces

Definition at line 256 of file testInterfaces.py.

00256 
00257     def doesImplementedBy(self, klass, interfaces):
00258         """ make sure that the klass implements at least these interfaces"""
00259         impl = self.getImplementedBy(klass)
00260         for interface in interfaces:
00261             self.failUnless(
00262                 interface in impl,
00263                 'The class %s does not implement %s' % (dottedName(klass),
00264                                                         dottedName(interface)))

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.tests.testInterfaces.zope_interface_test.doesProvidedBy (   self,
  instance,
  interfaces 
) [inherited]
make sure that the klass implements at least these interfaces

Definition at line 265 of file testInterfaces.py.

00265 
00266     def doesProvidedBy(self, instance, interfaces):
00267         """ make sure that the klass implements at least these interfaces"""
00268         impl = self.getProvidedBy(instance)
00269         for interface in interfaces:
00270             self.failUnless(
00271                 interface in impl,
00272                 'The instance of %s does not provide %s' % (dottedName(instance),
00273                                                             dottedName(interface)))

Here is the call graph for this function:

Here is the caller graph for this function:

returns the interfaces implemented by the klass (flat)

Definition at line 246 of file testInterfaces.py.

00246 
00247     def getImplementedBy(self, klass):
00248         """ returns the interfaces implemented by the klass (flat)"""
00249         from zope.interface import implementedBy
00250         return implementedBy(klass)

Here is the caller graph for this function:

def CMFPlone.tests.testInterfaces.InterfaceTest.getImplementsOf (   self,
  instance 
) [inherited]
returns the interfaces implemented by the instance (flat)

Definition at line 137 of file testInterfaces.py.

00137 
00138     def getImplementsOf(self, instance):
00139         """ returns the interfaces implemented by the instance (flat)"""
00140         from Interface.Implements import getImplements, flattenInterfaces
00141 
00142         impl = getImplements(instance)
00143         if type(impl) is not TupleType:
00144             impl = (impl,)
00145         if impl:
00146             return flattenInterfaces(impl)

Here is the call graph for this function:

Here is the caller graph for this function:

returns the interfaces implemented by the klass (flat)

Definition at line 127 of file testInterfaces.py.

00127 
00128     def getImplementsOfInstanceOf(self, klass):
00129         """ returns the interfaces implemented by the klass (flat)"""
00130         from Interface.Implements import getImplementsOfInstances, flattenInterfaces
00131 
00132         impl = getImplementsOfInstances(klass)
00133         if type(impl) is not TupleType:
00134             impl = (impl,)
00135         if impl:
00136             return flattenInterfaces(impl)

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.tests.testInterfaces.zope_interface_test.getProvidedBy (   self,
  instance 
) [inherited]
returns the interfaces implemented by the instance (flat)

Definition at line 251 of file testInterfaces.py.

00251 
00252     def getProvidedBy(self, instance):
00253         """ returns the interfaces implemented by the instance (flat)"""
00254         from zope.interface import providedBy
00255         return providedBy(instance)

Here is the caller graph for this function:

def CMFPlone.tests.testInterfaces.InterfaceTest.interfaceImplementedBy (   self,
  instance,
  interface 
) [inherited]
tests if the instance implements the interface in the right way 

Definition at line 109 of file testInterfaces.py.

00109 
00110     def interfaceImplementedBy(self, instance, interface):
00111         """ tests if the instance implements the interface in the right way """
00112         from Interface.Verify import verifyObject
00113         from Interface.Exceptions import BrokenImplementation, DoesNotImplement
00114         from Interface.Exceptions import BrokenMethodImplementation
00115 
00116         # is the class really implemented by the given interface?
00117         self.failUnless(interface.isImplementedBy(instance),
00118             'The instance of %s does not implement %s' % (dottedName(instance),
00119                                                           dottedName(interface)))
00120         # verify if the implementation is correct
00121         try:
00122             verifyObject(interface, instance)
00123         except (BrokenImplementation, DoesNotImplement,
00124           BrokenMethodImplementation), errmsg:
00125             self.fail('The instance of %s does not implement %s correctly: \n%s'
00126                 % (dottedName(instance), dottedName(interface), errmsg))

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.tests.testInterfaces.zope_interface_test.interfaceImplementedBy (   self,
  klass,
  interface 
) [inherited]
tests if the klass implements the interface in the right way 

Definition at line 204 of file testInterfaces.py.

00204 
00205     def interfaceImplementedBy(self, klass, interface):
00206         """ tests if the klass implements the interface in the right way """
00207 
00208         from zope.interface.verify import verifyClass
00209         from zope.interface.exceptions import BrokenImplementation, DoesNotImplement
00210         from zope.interface.exceptions import BrokenMethodImplementation
00211 
00212         # is the class really implemented by the given interface?
00213         self.failUnless(interface.implementedBy(klass),
00214             'The class %s does not implement %s' % (dottedName(klass),
00215                                                     dottedName(interface)))
00216         # verify if the implementation is correct
00217         try:
00218             verifyClass(interface, klass)
00219         except (BrokenImplementation, DoesNotImplement,
00220                 BrokenMethodImplementation), errmsg:
00221             self.fail('The class %s does not implement %s correctly: \n%s'
00222                       % (dottedName(klass), dottedName(interface), errmsg))
00223        except AttributeError, errmsg:
00224            self.fail('There was a problem while checking the implementation of '
00225                      'class %s and interface %s: \nAttributeError %s\n%s'
00226                     % (dottedName(klass), dottedName(interface), errmsg,
00227                          ''.join(traceback.format_tb(sys.exc_traceback))))

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.tests.testInterfaces.InterfaceTest.interfaceImplementedByInstanceOf (   self,
  klass,
  interface 
) [inherited]
tests if the klass implements the interface in the right way 

Definition at line 86 of file testInterfaces.py.

00086 
00087     def interfaceImplementedByInstanceOf(self, klass, interface):
00088         """ tests if the klass implements the interface in the right way """
00089         from Interface.Verify import verifyClass
00090         from Interface.Exceptions import BrokenImplementation, DoesNotImplement
00091         from Interface.Exceptions import BrokenMethodImplementation
00092 
00093         # is the class really implemented by the given interface?
00094         self.failUnless(interface.isImplementedByInstancesOf(klass),
00095             'The class %s does not implement %s' % (dottedName(klass),
00096                                                     dottedName(interface)))
00097         # verify if the implementation is correct
00098         try:
00099             verifyClass(interface, klass)
00100         except (BrokenImplementation, DoesNotImplement,
00101                 BrokenMethodImplementation), errmsg:
00102             self.fail('The class %s does not implement %s correctly: \n%s'
00103                       % (dottedName(klass), dottedName(interface), errmsg))
00104        except AttributeError, errmsg:
00105            self.fail('There was a problem while checking the implementation of '
00106                      'class %s and interface %s: \nAttributeError %s\n%s'
00107                     % (dottedName(klass), dottedName(interface), errmsg,
00108                          ''.join(traceback.format_tb(sys.exc_traceback))))

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.tests.testInterfaces.zope_interface_test.interfaceProvidedBy (   self,
  instance,
  interface 
) [inherited]
tests if the instance implements the interface in the right way 

Definition at line 228 of file testInterfaces.py.

00228 
00229     def interfaceProvidedBy(self, instance, interface):
00230         """ tests if the instance implements the interface in the right way """
00231         from zope.interface.verify import verifyObject
00232         from zope.interface.exceptions import BrokenImplementation, DoesNotImplement
00233         from zope.interface.exceptions import BrokenMethodImplementation
00234 
00235         # is the class really implemented by the given interface?
00236         self.failUnless(interface.providedBy(instance),
00237             'The instance of %s does not provide %s' % (dottedName(instance),
00238                                                         dottedName(interface)))
00239         # verify if the implementation is correct
00240         try:
00241             verifyObject(interface, instance)
00242         except (BrokenImplementation, DoesNotImplement,
00243                 BrokenMethodImplementation), errmsg:
00244             self.fail('The instance of %s does not provide %s correctly: \n%s'
00245                       % (dottedName(instance), dottedName(interface), errmsg))

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Reimplemented from CMFPlone.tests.testInterfaces.InterfaceTest.

Definition at line 336 of file testInterfaces.py.

Reimplemented in CMFPlone.tests.testInterfaces.InstanceInterfaceTest.

Definition at line 83 of file testInterfaces.py.

Reimplemented in CMFPlone.tests.testInterfaces.InstanceInterfaceTest.

Definition at line 201 of file testInterfaces.py.

Reimplemented from CMFPlone.tests.testInterfaces.InterfaceTest.

Definition at line 335 of file testInterfaces.py.


The documentation for this class was generated from the following file: